1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
@SerialVersionUID(42) class C @SerialVersionUID(43 - 1) class D object Test extends dotty.runtime.LegacyApp { def checkId(cls: Class[_]): Unit = { val id = cls.getDeclaredField("serialVersionUID").get(null) assert(id == 42, (cls, id)) } checkId(classOf[C]) checkId(classOf[D]) }