You should avoid naming your case class as String
, especially in your case, with String
parameter type:
case class String(s: String)
It would confuse the compiler to expect a parameter type different from the actual String
type you want. Your app will work if you explicitly specify java.lang.String
as the parameter type:
case class String(s: java.lang.String)
In any case, I would not recommend naming a case class as String
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…