2013-05-14 67 views
5

在斯卡拉2.9我会使用import scala.annotation.target.field注释的情况下类:斯卡拉案例类的注释在2.10中改变了吗?

case class UserAuth(
    @([email protected])("email") 
    val email: String, 

    @([email protected])("password") 
    val password: String 
) 

在2.10我去编译一个类,我需要使用import scala.annotation.meta.field但突然它抛出编译器错误像疯了似的。这是Scala案例类注释的正确用法,还是可以恢复为简单的@JsonProperty("email")

回答

4

看起来这是编译器中的某种奇怪的错误,但我可以确认使用import scala.annotation.meta.field的语法@([email protected])("email")确实有效。

看起来类没有正确加载,并且一个简单的sbt clean修复了这个问题。如果问题仍然存在,将提交错误。

+0

+2。我已经提出了问题和答案。谢谢。 –