动态特征 NoSuchFieldError @2.9.0RC4
以下内容是错误还是故意的?
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
Is the following a bug or on purpose?
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可能是错误的另一个实例 #4560
That's probably another instance of bug #4560