diff options
Diffstat (limited to 'test/files/run/t4788-separate-compilation')
8 files changed, 61 insertions, 0 deletions
diff --git a/test/files/run/t4788-separate-compilation/CAnnotation_1.java b/test/files/run/t4788-separate-compilation/CAnnotation_1.java new file mode 100644 index 0000000000..7120218d62 --- /dev/null +++ b/test/files/run/t4788-separate-compilation/CAnnotation_1.java @@ -0,0 +1,5 @@ +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.CLASS; + +@Retention(value=CLASS) +@interface CAnnotation {} diff --git a/test/files/run/t4788-separate-compilation/C_1.scala b/test/files/run/t4788-separate-compilation/C_1.scala new file mode 100644 index 0000000000..aba9b595e4 --- /dev/null +++ b/test/files/run/t4788-separate-compilation/C_1.scala @@ -0,0 +1,2 @@ +@CAnnotation +class C diff --git a/test/files/run/t4788-separate-compilation/D_1.scala b/test/files/run/t4788-separate-compilation/D_1.scala new file mode 100644 index 0000000000..c2479fba86 --- /dev/null +++ b/test/files/run/t4788-separate-compilation/D_1.scala @@ -0,0 +1,5 @@ +@Deprecated +class DJava + +@deprecated("", "") +class DScala diff --git a/test/files/run/t4788-separate-compilation/RAnnotation_1.java b/test/files/run/t4788-separate-compilation/RAnnotation_1.java new file mode 100644 index 0000000000..f24cf66f7b --- /dev/null +++ b/test/files/run/t4788-separate-compilation/RAnnotation_1.java @@ -0,0 +1,5 @@ +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +@Retention(value=RUNTIME) +@interface RAnnotation {} diff --git a/test/files/run/t4788-separate-compilation/R_1.scala b/test/files/run/t4788-separate-compilation/R_1.scala new file mode 100644 index 0000000000..ab0cd065d9 --- /dev/null +++ b/test/files/run/t4788-separate-compilation/R_1.scala @@ -0,0 +1,2 @@ +@RAnnotation +class R diff --git a/test/files/run/t4788-separate-compilation/SAnnotation_1.java b/test/files/run/t4788-separate-compilation/SAnnotation_1.java new file mode 100644 index 0000000000..471f27d82a --- /dev/null +++ b/test/files/run/t4788-separate-compilation/SAnnotation_1.java @@ -0,0 +1,5 @@ +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.SOURCE; + +@Retention(value=SOURCE) +@interface SAnnotation {} diff --git a/test/files/run/t4788-separate-compilation/S_1.scala b/test/files/run/t4788-separate-compilation/S_1.scala new file mode 100644 index 0000000000..f8756d9bc8 --- /dev/null +++ b/test/files/run/t4788-separate-compilation/S_1.scala @@ -0,0 +1,2 @@ +@SAnnotation +class S diff --git a/test/files/run/t4788-separate-compilation/Test_2.scala b/test/files/run/t4788-separate-compilation/Test_2.scala new file mode 100644 index 0000000000..cbbb5ff386 --- /dev/null +++ b/test/files/run/t4788-separate-compilation/Test_2.scala @@ -0,0 +1,35 @@ +import java.io.PrintWriter; + +import scala.tools.partest.BytecodeTest +import scala.tools.asm.util._ +import scala.tools.nsc.util.stringFromWriter + +object Test extends BytecodeTest { + def annotationsForClass(className: String): Option[String] = { + val classNode = loadClassNode(className, skipDebugInfo = false) + val textifier = new Textifier + classNode.accept(new TraceClassVisitor(null, textifier, null)) + + val classString = stringFromWriter(w => textifier.print(w)) + classString + .split('\n') + .filterNot(_.contains("@Lscala/reflect/ScalaSignature")) + .find(_.contains("@L")) + .map(_.trim) + } + + def show { + // It seems like @java.lang.Deprecated shows up in both the + // Deprecated attribute and RuntimeVisibleAnnotation attribute, + // while @scala.deprecated only shows up in the Deprecated attribute. + // The check file just documents status quo, not sure if Scala + // should brought in line with Java or not... + // See the commit message and SI-8883 for more info. + println(annotationsForClass("DJava")) + println(annotationsForClass("DScala")) + + println(annotationsForClass("S")) + println(annotationsForClass("C")) + println(annotationsForClass("R")) + } +} |