summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLex Spoon <lex@lexspoon.org>2007-10-02 16:58:39 +0000
committerLex Spoon <lex@lexspoon.org>2007-10-02 16:58:39 +0000
commit2a22d4156be506278141446ddd3729aea26ab77f (patch)
tree9c8fce62aa7f032a302510bc0d737cce414f3d7b /src
parent40884972d9de5933503cd1f75c1a8f42360a8b62 (diff)
downloadscala-2a22d4156be506278141446ddd3729aea26ab77f.tar.gz
scala-2a22d4156be506278141446ddd3729aea26ab77f.tar.bz2
scala-2a22d4156be506278141446ddd3729aea26ab77f.zip
Emit a warning if a user tries to define
their own subclass of ClassfileAnnotation
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 1ef6b935e7..c608617ce0 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -1013,6 +1013,11 @@ trait Typers { self: Analyzer =>
val impl1 = newTyper(context.make(cdef.impl, clazz, scopeFor(cdef.impl)))
.typedTemplate(cdef.impl, parentTypes(cdef.impl))
val impl2 = addSyntheticMethods(impl1, clazz, context)
+ if (clazz isNonBottomSubClass ClassfileAnnotationClass)
+ unit.warning (cdef.pos,
+ "implementation restriction: subclassing Classfile does not\n"+
+ "make your annotation visible at runtime. If that is what\n"+
+ "you want, you must write the annotation class in Java.")
copy.ClassDef(cdef, typedMods, cdef.name, tparams1, impl2)
.setType(NoType)
}