diff options
author | Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> | 2014-10-07 19:47:42 +0200 |
---|---|---|
committer | Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> | 2014-10-07 19:47:42 +0200 |
commit | 382b33e539c77c3af317b606a1463e2826e60f95 (patch) | |
tree | e64a7c70acd12c792ac66a34058cd97b804f323c | |
parent | 0940f19dc6809ee7622dda1b76121af628d5b435 (diff) | |
parent | ea0d4e4e4f05b6b71f4b230ab4b92431cb902e49 (diff) | |
download | scala-382b33e539c77c3af317b606a1463e2826e60f95.tar.gz scala-382b33e539c77c3af317b606a1463e2826e60f95.tar.bz2 scala-382b33e539c77c3af317b606a1463e2826e60f95.zip |
Merge pull request #4028 from soc/topic/serialversionuid-spam
Avoid ClassfileAnnotation warning for @SerialVersionUID
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index b498d9e667..aae2d24b32 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -1726,7 +1726,10 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper if ((clazz isNonBottomSubClass ClassfileAnnotationClass) && (clazz != ClassfileAnnotationClass)) { if (!clazz.owner.isPackageClass) context.error(clazz.pos, "inner classes cannot be classfile annotations") - else restrictionWarning(cdef.pos, unit, + // Ignore @SerialVersionUID, because it is special-cased and handled completely differently. + // It only extends ClassfileAnnotationClass instead of StaticAnnotation to get the enforcement + // of constant argument values "for free". Related to SI-7041. + else if (clazz != SerialVersionUIDAttr) restrictionWarning(cdef.pos, unit, """|subclassing Classfile does not |make your annotation visible at runtime. If that is what |you want, you must write the annotation class in Java.""".stripMargin) |