diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2014-05-17 23:43:12 +0200 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2014-05-17 23:43:12 +0200 |
commit | 7872ea495a9e39f3c37e1662837cacb769a9f359 (patch) | |
tree | 5008df3ee546acc50a76b73680f53415a8b85d84 /test/files | |
parent | c763d8413b8e1ef5129378952b2327e8a7c2de7d (diff) | |
parent | f9abdcef6c9b8d96e1aaf98942938e2e875285d0 (diff) | |
download | scala-7872ea495a9e39f3c37e1662837cacb769a9f359.tar.gz scala-7872ea495a9e39f3c37e1662837cacb769a9f359.tar.bz2 scala-7872ea495a9e39f3c37e1662837cacb769a9f359.zip |
Merge pull request #3738 from retronym/ticket/8574
SI-8574 Copy @SerialVersionUID, etc, to specialized subclasses
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/neg/t6162-inheritance.check | 8 | ||||
-rw-r--r-- | test/files/run/t8574.scala | 27 |
2 files changed, 28 insertions, 7 deletions
diff --git a/test/files/neg/t6162-inheritance.check b/test/files/neg/t6162-inheritance.check index 13c78030d9..c9f4ddaec1 100644 --- a/test/files/neg/t6162-inheritance.check +++ b/test/files/neg/t6162-inheritance.check @@ -7,12 +7,6 @@ object SubT extends T usage.scala:8: warning: inheritance from trait S in package t6126 is deprecated new S { ^ -usage.scala:3: warning: inheritance from class Foo in package t6126 is deprecated: `Foo` will be made final in a future version. -class SubFoo extends Foo - ^ -usage.scala:5: warning: inheritance from trait T in package t6126 is deprecated -object SubT extends T - ^ error: No warnings can be incurred under -Xfatal-warnings. -5 warnings found +three warnings found one error found diff --git a/test/files/run/t8574.scala b/test/files/run/t8574.scala new file mode 100644 index 0000000000..8c23ada482 --- /dev/null +++ b/test/files/run/t8574.scala @@ -0,0 +1,27 @@ +import annotation._ + +@SerialVersionUID(42) @strictfp class Foo[@specialized(Int) T] extends Serializable { + def foo(t: T) = t +} + +object Test extends App { + def checkUID(cls: Class[_], expected: Long) = { + val actual = java.io.ObjectStreamClass.lookup(cls).getSerialVersionUID + assert(actual == expected, s"$actual != expected for ${cls}") + } + def checkStrictFp(cls: Class[_]) = { + import java.lang.reflect._ + for (m <- cls.getDeclaredMethods) { + val isStrict = Modifier.isStrict(m.getModifiers) + assert(isStrict, cls) + } + } + def check(x: AnyRef) { + checkUID(x.getClass, 42) + checkStrictFp(x.getClass) + } + + check(new Foo[String]) + check(new Foo[Int]) +} + |