summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Typers.scala
diff options
context:
space:
mode:
authorSimon Ochsenreither <simon@ochsenreither.de>2014-10-04 00:03:46 +0200
committerSimon Ochsenreither <simon@ochsenreither.de>2014-10-07 16:55:58 +0200
commitea0d4e4e4f05b6b71f4b230ab4b92431cb902e49 (patch)
treee64a7c70acd12c792ac66a34058cd97b804f323c /src/compiler/scala/tools/nsc/typechecker/Typers.scala
parent0940f19dc6809ee7622dda1b76121af628d5b435 (diff)
downloadscala-ea0d4e4e4f05b6b71f4b230ab4b92431cb902e49.tar.gz
scala-ea0d4e4e4f05b6b71f4b230ab4b92431cb902e49.tar.bz2
scala-ea0d4e4e4f05b6b71f4b230ab4b92431cb902e49.zip
Avoid ClassfileAnnotation warning for @SerialVersionUID
@SerialVersionUID is special-cased, the warning doesn't apply. Related to SI-7041.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala5
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)