我试图在以下(最简单的)代码中调用typeOfInstance()方法:
import scala.reflect.mirror._
class Bar
object Main extends App {
val bar = new Bar()
typeOfInstance(bar)
}但是,在执行AssertionError时,我正在接收它:
java.lang.AssertionError: assertion failed: no symbol could be loaded from package annotation (scala equivalent is class com.hablapps.annotation.Bar) by name Bar上面的代码在REPL中运行良好(使用:power模式)。从SBT运行时会出现问题(Scala2.10-M3集)。有人知道会发生什么吗?
发布于 2012-06-26 15:23:17
这是M3已知的一个问题。
在Scala的预览版本中,反射只适用于简单的类加载方案(例如,当您使用好的旧java -cp <classpath> <name of the main class>运行应用程序时)。SBT参与得更多,事情就会变得更糟。
我们已经在2.10.0-M4中解决了这个问题。
https://stackoverflow.com/questions/10797850
复制相似问题