Permalink
Browse files

Added test for untested nested annotation restriction.

  • Loading branch information...
1 parent 76bb23d commit e626ecd2346b917d1b3397e0159bca4862214e9d @paulp paulp committed Jan 15, 2013
Showing with 19 additions and 0 deletions.
  1. +10 −0 test/files/neg/nested-annotation.check
  2. +9 −0 test/files/neg/nested-annotation.scala
@@ -0,0 +1,10 @@
+nested-annotation.scala:3: warning: Implementation restriction: subclassing Classfile does not
+make your annotation visible at runtime. If that is what
+you want, you must write the annotation class in Java.
+class ComplexAnnotation(val value: Annotation) extends ClassfileAnnotation
+ ^
+nested-annotation.scala:8: error: nested classfile annotations must be defined in java; found: inline
+ @ComplexAnnotation(new inline) def bippy(): Int = 1
+ ^
+one warning found
+one error found
@@ -0,0 +1,9 @@
+import annotation._
+
+class ComplexAnnotation(val value: Annotation) extends ClassfileAnnotation
+
+class A {
+ // It's hard to induce this error because @ComplexAnnotation(@inline) is a parse
+ // error so it never gets out of the parser, but:
+ @ComplexAnnotation(new inline) def bippy(): Int = 1
+}

0 comments on commit e626ecd

Please sign in to comment.