我想在运行时使用scala v2.11.6 编译scala类。
错误“包scala没有成员Int ”的原因是什么?
scala.reflect.internal.FatalError: package scala does not have a member Int
at scala.reflect.internal.Definitions$DefinitionsClass.scala$reflect$internal$Definitions$DefinitionsClass$$fatalMissingSymbol(Definitions.scala:1183)
at scala.reflect.internal.Definitions$DefinitionsClass.getMember(Definitions.scala:1200)
at scala.reflect.internal.Definitions$ValueClassDefinitions$class.valueClassSymbol(Definitions.scala:77)
at scala.reflect.internal.Definitions$ValueClassDefinitions$class.IntClass(Definitions.scala:114)
at scala.reflect.internal.Definitions$DefinitionsClass.IntClass$lzycompute(Definitions.scala:153)
at scala.reflect.internal.Definitions$DefinitionsClass.IntClass(Definitions.scala:153)
at scala.reflect.internal.Definitions$ValueClassDefinitions$class.IntTpe(Definitions.scala:127)
at scala.reflect.internal.Definitions$DefinitionsClass.IntTpe$lzycompute(Definitions.scala:153)
at scala.reflect.internal.Definitions$DefinitionsClass.IntTpe(Definitions.scala:153)
at scala.tools.nsc.symtab.classfile.ClassfileParser.sig2type$1(ClassfileParser.scala:622)
at scala.tools.nsc.symtab.classfile.ClassfileParser.sig2type$1(ClassfileParser.scala:720)
at scala.tools.nsc.symtab.classfile.ClassfileParser.scala$tools$nsc$symtab$classfile$ClassfileParser$$sigToType(ClassfileParser.scala:766)
at scala.tools.nsc.symtab.classfile.ClassfileParser$ConstantPool.getType(ClassfileParser.scala:283)
at scala.tools.nsc.symtab.classfile.ClassfileParser.parseMethod(ClassfileParser.scala:560)
at scala.tools.nsc.symtab.classfile.ClassfileParser.scala$tools$nsc$symtab$classfile$ClassfileParser$$queueLoad$1(ClassfileParser.scala:477)
at scala.tools.nsc.symtab.classfile.ClassfileParser$$anonfun$parseClass$1.apply$mcV$sp(ClassfileParser.scala:487)
at scala.tools.nsc.symtab.classfile.ClassfileParser.parseClass(ClassfileParser.scala:492)
at scala.tools.nsc.symtab.classfile.ClassfileParser.parse(ClassfileParser.scala:133)
at scala.tools.nsc.symtab.SymbolLoaders$ClassfileLoader$$anonfun$doComplete$2.apply$mcV$sp(SymbolLoaders.scala:348)
at scala.tools.nsc.symtab.SymbolLoaders$ClassfileLoader$$anonfun$doComplete$2.apply(SymbolLoaders.scala:348)
at scala.tools.nsc.symtab.SymbolLoaders$ClassfileLoader$$anonfun$doComplete$2.apply(SymbolLoaders.scala:348)
at scala.reflect.internal.SymbolTable.enteringPhase(SymbolTable.scala:235)
at scala.tools.nsc.symtab.SymbolLoaders$ClassfileLoader.doComplete(SymbolLoaders.scala:348)
at scala.tools.nsc.symtab.SymbolLoaders$SymbolLoader.complete(SymbolLoaders.scala:212)
at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1488)
at scala.reflect.internal.Symbols$Symbol.initialize(Symbols.scala:1633)
at scala.reflect.internal.Definitions$DefinitionsClass.init(Definitions.scala:1391)
at scala.tools.nsc.Global$Run.<init>(Global.scala:1216)
代码段:
val sem = new ScriptEngineManager().getEngineByName("scala")
val settings = sem.asInstanceOf[scala.tools.nsc.interpreter.IMain].settings
settings.embeddedDefaults[Int]
settings.usejavacp.value = true
sem.eval("println()") <- error here
似乎只有这个错误才能播放特定的框架应用程序。