动态特征NoSuchFieldError @ 2.9.0RC4

时间:2011-05-11 08:57:00

标签: scala

以下是错误还是故意?

trait Dyn {
  val D1 = new Dynamic {
    def applyDynamic(name: String)(args: Any*) = "Hi"
  }
  object D2 extends Dynamic {
    def applyDynamic(name: String)(args: Any*) = "Hey"
  }
}
trait T { self: Dyn =>
  def foo1 = D1.X
  def foo2 = D2.X
}
object T extends T with Dyn
object Dyn extends Dyn

T.D1.X // works
Dyn.D1.X  // works
T.foo1 // doesn't work: java.lang.NoSuchFieldError: reflPoly$Cache1

T.D2.X // works
Dyn.D2.X  // works
T.foo2 // works

1 个答案:

答案 0 :(得分:0)

这可能是bug #4560

的另一个例子