summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Kossakowski <grzegorz.kossakowski@gmail.com>2014-10-07 19:47:42 +0200
committerGrzegorz Kossakowski <grzegorz.kossakowski@gmail.com>2014-10-07 19:47:42 +0200
commit382b33e539c77c3af317b606a1463e2826e60f95 (patch)
treee64a7c70acd12c792ac66a34058cd97b804f323c
parent0940f19dc6809ee7622dda1b76121af628d5b435 (diff)
parentea0d4e4e4f05b6b71f4b230ab4b92431cb902e49 (diff)
downloadscala-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.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)