We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.
Already on GitHub?
to your account
It seems that if you provide serial version UID to the annotation as anything else rather than long literal scala compiler just silently ignores its value.
It should either accept the value or raise an error, failing the compilation.
case class User()
@SerialVersionUID(13.asInstanceOf[Long]) case class IdentifyMessage1(userName: String, user: User, code: Int)
@SerialVersionUID(13l) case class IdentifyMessage2(userName: String, user: User, code: Int)
val SerialUID = "13".toLong
@SerialVersionUID(SerialUID) case class IdentifyMessage3(userName: String, user: User, code: Int)
println("#1 " + java.io.ObjectStreamClass.lookup(IdentifyMessage1("hei", User(), 8).getClass).getSerialVersionUID)
println("#2 " + java.io.ObjectStreamClass.lookup(IdentifyMessage2("hei", User(), 8).getClass).getSerialVersionUID)
println("#3 " + java.io.ObjectStreamClass.lookup(IdentifyMessage3("hei", User(), 8).getClass).getSerialVersionUID)
Running this code should print out 13 for all classes, but only #2 is correct.
The text was updated successfully, but these errors were encountered:
Imported From: https://issues.scala-lang.org/browse/SI-6988?orig=1
Reporter: Artūras Šlajus (arturaz)
Affected Versions: 2.9.2, 2.10.0
Sorry, something went wrong.
Artūras Šlajus (arturaz) said:
Also check out:
No branches or pull requests