diff options
-rw-r--r-- | test/files/neg/t6988.check | 7 | ||||
-rw-r--r-- | test/files/neg/t6988.scala | 10 | ||||
-rw-r--r-- | test/files/run/t6988.check | 2 | ||||
-rw-r--r-- | test/files/run/t6988.scala | 9 |
4 files changed, 28 insertions, 0 deletions
diff --git a/test/files/neg/t6988.check b/test/files/neg/t6988.check new file mode 100644 index 0000000000..acb7b3cb08 --- /dev/null +++ b/test/files/neg/t6988.check @@ -0,0 +1,7 @@ +t6988.scala:3: error: annotation argument needs to be a constant; found: 13.asInstanceOf[Long] +@SerialVersionUID(13.asInstanceOf[Long]) case class IdentifyMessage1(userName: String, user: User, code: Int) + ^ +t6988.scala:8: error: annotation argument needs to be a constant; found: O.SerialUID +@SerialVersionUID(O.SerialUID) case class IdentifyMessage3(userName: String, user: User, code: Int) + ^ +two errors found diff --git a/test/files/neg/t6988.scala b/test/files/neg/t6988.scala new file mode 100644 index 0000000000..8171dc9dd0 --- /dev/null +++ b/test/files/neg/t6988.scala @@ -0,0 +1,10 @@ +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) +object O { + val SerialUID = "13".toLong +} +@SerialVersionUID(O.SerialUID) case class IdentifyMessage3(userName: String, user: User, code: Int) + + diff --git a/test/files/run/t6988.check b/test/files/run/t6988.check new file mode 100644 index 0000000000..5db04832d6 --- /dev/null +++ b/test/files/run/t6988.check @@ -0,0 +1,2 @@ +#1 13 +#2 13 diff --git a/test/files/run/t6988.scala b/test/files/run/t6988.scala new file mode 100644 index 0000000000..45dfe33461 --- /dev/null +++ b/test/files/run/t6988.scala @@ -0,0 +1,9 @@ +case class User() + +@SerialVersionUID(13l) case class IdentifyMessage1(userName: String, user: User, code: Int) +@SerialVersionUID(10l + 3l) case class IdentifyMessage2(userName: String, user: User, code: Int) + +object Test extends App { + println("#1 " + java.io.ObjectStreamClass.lookup(IdentifyMessage1("hei", User(), 8).getClass).getSerialVersionUID) + println("#2 " + java.io.ObjectStreamClass.lookup(IdentifyMessage2("hei", User(), 8).getClass).getSerialVersionUID) +} |