From adf50a3ac0c6861a77a781abc0814c5d17927175 Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Fri, 1 Feb 2013 19:23:00 +0100 Subject: evicts javac-artifacts.jar Apparently, the usual _1, _2, _3... naming scheme also works for java files, which need to be compiled together with partests. This allows us to get rid of javac-artifacts.jar. --- test/files/run/reflection-java-annotations.check | 2 +- test/files/run/reflection-java-annotations.scala | 7 ---- .../JavaAnnottee_1.java | 47 ++++++++++++++++++++++ .../JavaComplexAnnotation_1.java | 34 ++++++++++++++++ .../JavaSimpleAnnotation_1.java | 21 ++++++++++ .../JavaSimpleEnumeration_1.java | 4 ++ .../run/reflection-java-annotations/Test_2.scala | 7 ++++ test/files/run/reflection-java-crtp.scala | 8 ---- .../JavaSimpleEnumeration_1.java | 4 ++ test/files/run/reflection-java-crtp/Main_2.scala | 8 ++++ test/files/run/t6548.check | 2 +- test/files/run/t6548.scala | 12 ------ .../run/t6548/JavaAnnotationWithNestedEnum_1.java | 17 ++++++++ test/files/run/t6548/Test_2.scala | 12 ++++++ test/files/run/t7008/Impls_Macros_1.scala | 12 ------ test/files/run/t7008/Impls_Macros_2.scala | 12 ++++++ .../t7008/JavaClassWithCheckedExceptions_1.java | 7 ++++ test/files/run/t7008/Test_2.scala | 9 ----- test/files/run/t7008/Test_3.scala | 9 +++++ 19 files changed, 184 insertions(+), 50 deletions(-) delete mode 100644 test/files/run/reflection-java-annotations.scala create mode 100644 test/files/run/reflection-java-annotations/JavaAnnottee_1.java create mode 100644 test/files/run/reflection-java-annotations/JavaComplexAnnotation_1.java create mode 100644 test/files/run/reflection-java-annotations/JavaSimpleAnnotation_1.java create mode 100644 test/files/run/reflection-java-annotations/JavaSimpleEnumeration_1.java create mode 100644 test/files/run/reflection-java-annotations/Test_2.scala delete mode 100644 test/files/run/reflection-java-crtp.scala create mode 100644 test/files/run/reflection-java-crtp/JavaSimpleEnumeration_1.java create mode 100644 test/files/run/reflection-java-crtp/Main_2.scala delete mode 100644 test/files/run/t6548.scala create mode 100644 test/files/run/t6548/JavaAnnotationWithNestedEnum_1.java create mode 100644 test/files/run/t6548/Test_2.scala delete mode 100644 test/files/run/t7008/Impls_Macros_1.scala create mode 100644 test/files/run/t7008/Impls_Macros_2.scala create mode 100644 test/files/run/t7008/JavaClassWithCheckedExceptions_1.java delete mode 100644 test/files/run/t7008/Test_2.scala create mode 100644 test/files/run/t7008/Test_3.scala (limited to 'test/files/run') diff --git a/test/files/run/reflection-java-annotations.check b/test/files/run/reflection-java-annotations.check index 53c53cfbcc..2d37fff1f4 100644 --- a/test/files/run/reflection-java-annotations.check +++ b/test/files/run/reflection-java-annotations.check @@ -1 +1 @@ -List(JavaComplexAnnotation(v1 = 1, v10 = "hello", v101 = [101, 101], v102 = [102, 102], v103 = ['g', 'g'], v104 = [104, 104], v105 = [105L, 105L], v106 = [106.0, 106.0], v107 = [107.0, 107.0], v108 = [false, true], v11 = classOf[JavaAnnottee], v110 = ["hello", "world"], v111 = [classOf[JavaSimpleAnnotation], classOf[JavaComplexAnnotation]], v112 = [FOO, BAR], v113 = [JavaSimpleAnnotation(v1 = 21, v10 = "world2", v11 = classOf[JavaComplexAnnotation], v12 = BAR, v2 = 22, v3 = '\027', v4 = 24, v5 = 25L, v6 = 26.0, v7 = 27.0, v8 = false)], v12 = FOO, v13 = JavaSimpleAnnotation(v1 = 11, v10 = "world1", v11 = classOf[JavaSimpleAnnotation], v12 = FOO, v2 = 12, v3 = '\r', v4 = 14, v5 = 15L, v6 = 16.0, v7 = 17.0, v8 = false), v2 = 2, v3 = '\03', v4 = 4, v5 = 5L, v6 = 6.0, v7 = 7.0, v8 = false)) +List(JavaComplexAnnotation_1(v1 = 1, v10 = "hello", v101 = [101, 101], v102 = [102, 102], v103 = ['g', 'g'], v104 = [104, 104], v105 = [105L, 105L], v106 = [106.0, 106.0], v107 = [107.0, 107.0], v108 = [false, true], v11 = classOf[JavaAnnottee_1], v110 = ["hello", "world"], v111 = [classOf[JavaSimpleAnnotation_1], classOf[JavaComplexAnnotation_1]], v112 = [FOO, BAR], v113 = [JavaSimpleAnnotation_1(v1 = 21, v10 = "world2", v11 = classOf[JavaComplexAnnotation_1], v12 = BAR, v2 = 22, v3 = '\027', v4 = 24, v5 = 25L, v6 = 26.0, v7 = 27.0, v8 = false)], v12 = FOO, v13 = JavaSimpleAnnotation_1(v1 = 11, v10 = "world1", v11 = classOf[JavaSimpleAnnotation_1], v12 = FOO, v2 = 12, v3 = '\r', v4 = 14, v5 = 15L, v6 = 16.0, v7 = 17.0, v8 = false), v2 = 2, v3 = '\03', v4 = 4, v5 = 5L, v6 = 6.0, v7 = 7.0, v8 = false)) diff --git a/test/files/run/reflection-java-annotations.scala b/test/files/run/reflection-java-annotations.scala deleted file mode 100644 index 2e3fed48ce..0000000000 --- a/test/files/run/reflection-java-annotations.scala +++ /dev/null @@ -1,7 +0,0 @@ -object Test extends App { - import scala.reflect.runtime.universe._ - val sym = typeOf[JavaAnnottee].typeSymbol - sym.typeSignature - sym.annotations foreach (_.javaArgs) - println(sym.annotations) -} \ No newline at end of file diff --git a/test/files/run/reflection-java-annotations/JavaAnnottee_1.java b/test/files/run/reflection-java-annotations/JavaAnnottee_1.java new file mode 100644 index 0000000000..b241f5d25e --- /dev/null +++ b/test/files/run/reflection-java-annotations/JavaAnnottee_1.java @@ -0,0 +1,47 @@ +@JavaComplexAnnotation_1( + v1 = (byte)1, + v2 = (short)2, + v3 = (char)3, + v4 = (int)4, + v5 = (long)5, + v6 = (float)6, + v7 = (double)7, + v10 = "hello", + v11 = JavaAnnottee_1.class, + v12 = JavaSimpleEnumeration_1.FOO, + v13 = @JavaSimpleAnnotation_1( + v1 = (byte)11, + v2 = (short)12, + v3 = (char)13, + v4 = (int)14, + v5 = (long)15, + v6 = (float)16, + v7 = (double)17, + v10 = "world1", + v11 = JavaSimpleAnnotation_1.class, + v12 = JavaSimpleEnumeration_1.FOO + ), + v101 = {(byte)101, (byte)101}, + v102 = {(short)102, (short)102}, + v103 = {(char)103, (char)103}, + v104 = {(int)104, (int)104}, + v105 = {(long)105, (long)105}, + v106 = {(float)106, (float)106}, + v107 = {(double)107, (double)107}, + v108 = {false, true}, + v110 = {"hello", "world"}, + v111 = {JavaSimpleAnnotation_1.class, JavaComplexAnnotation_1.class}, + v112 = {JavaSimpleEnumeration_1.FOO, JavaSimpleEnumeration_1.BAR}, + v113 = {@JavaSimpleAnnotation_1( + v1 = (byte)21, + v2 = (short)22, + v3 = (char)23, + v4 = (int)24, + v5 = (long)25, + v6 = (float)26, + v7 = (double)27, + v10 = "world2", + v11 = JavaComplexAnnotation_1.class, + v12 = JavaSimpleEnumeration_1.BAR + )}) +public class JavaAnnottee_1 {} \ No newline at end of file diff --git a/test/files/run/reflection-java-annotations/JavaComplexAnnotation_1.java b/test/files/run/reflection-java-annotations/JavaComplexAnnotation_1.java new file mode 100644 index 0000000000..645eeb9399 --- /dev/null +++ b/test/files/run/reflection-java-annotations/JavaComplexAnnotation_1.java @@ -0,0 +1,34 @@ +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.FIELD, ElementType.METHOD, ElementType.TYPE}) +public @interface JavaComplexAnnotation_1 { + byte v1(); + short v2(); + char v3(); + int v4(); + long v5(); + float v6(); + double v7(); + boolean v8() default false; + // void v9(); + String v10(); + Class v11(); + JavaSimpleEnumeration_1 v12(); + JavaSimpleAnnotation_1 v13(); + byte[] v101(); + short[] v102(); + char[] v103(); + int[] v104(); + long[] v105(); + float[] v106(); + double[] v107(); + boolean[] v108(); + String[] v110(); + Class[] v111(); + JavaSimpleEnumeration_1[] v112(); + JavaSimpleAnnotation_1[] v113(); +} \ No newline at end of file diff --git a/test/files/run/reflection-java-annotations/JavaSimpleAnnotation_1.java b/test/files/run/reflection-java-annotations/JavaSimpleAnnotation_1.java new file mode 100644 index 0000000000..c0f92fad2c --- /dev/null +++ b/test/files/run/reflection-java-annotations/JavaSimpleAnnotation_1.java @@ -0,0 +1,21 @@ +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.FIELD, ElementType.METHOD, ElementType.TYPE}) +public @interface JavaSimpleAnnotation_1 { + byte v1(); + short v2(); + char v3(); + int v4(); + long v5(); + float v6(); + double v7(); + boolean v8() default false; + // void v9(); + String v10(); + Class v11(); + JavaSimpleEnumeration_1 v12(); +} \ No newline at end of file diff --git a/test/files/run/reflection-java-annotations/JavaSimpleEnumeration_1.java b/test/files/run/reflection-java-annotations/JavaSimpleEnumeration_1.java new file mode 100644 index 0000000000..39246141cc --- /dev/null +++ b/test/files/run/reflection-java-annotations/JavaSimpleEnumeration_1.java @@ -0,0 +1,4 @@ +enum JavaSimpleEnumeration_1 { + FOO, + BAR +} \ No newline at end of file diff --git a/test/files/run/reflection-java-annotations/Test_2.scala b/test/files/run/reflection-java-annotations/Test_2.scala new file mode 100644 index 0000000000..d2c3157071 --- /dev/null +++ b/test/files/run/reflection-java-annotations/Test_2.scala @@ -0,0 +1,7 @@ +object Test extends App { + import scala.reflect.runtime.universe._ + val sym = typeOf[JavaAnnottee_1].typeSymbol + sym.typeSignature + sym.annotations foreach (_.javaArgs) + println(sym.annotations) +} \ No newline at end of file diff --git a/test/files/run/reflection-java-crtp.scala b/test/files/run/reflection-java-crtp.scala deleted file mode 100644 index 260d3540dc..0000000000 --- a/test/files/run/reflection-java-crtp.scala +++ /dev/null @@ -1,8 +0,0 @@ -object Test extends App { - import scala.reflect.runtime.universe._ - val enum = typeOf[JavaSimpleEnumeration].baseClasses(1).asClass - // make sure that the E's in Enum> are represented by the same symbol - val e1 = enum.typeParams(0).asType - val TypeBounds(_, TypeRef(_, _, List(TypeRef(_, e2: TypeSymbol, _)))) = e1.typeSignature - println(e1, e2, e1 eq e2) -} \ No newline at end of file diff --git a/test/files/run/reflection-java-crtp/JavaSimpleEnumeration_1.java b/test/files/run/reflection-java-crtp/JavaSimpleEnumeration_1.java new file mode 100644 index 0000000000..39246141cc --- /dev/null +++ b/test/files/run/reflection-java-crtp/JavaSimpleEnumeration_1.java @@ -0,0 +1,4 @@ +enum JavaSimpleEnumeration_1 { + FOO, + BAR +} \ No newline at end of file diff --git a/test/files/run/reflection-java-crtp/Main_2.scala b/test/files/run/reflection-java-crtp/Main_2.scala new file mode 100644 index 0000000000..fb5668f323 --- /dev/null +++ b/test/files/run/reflection-java-crtp/Main_2.scala @@ -0,0 +1,8 @@ +object Test extends App { + import scala.reflect.runtime.universe._ + val enum = typeOf[JavaSimpleEnumeration_1].baseClasses(1).asClass + // make sure that the E's in Enum> are represented by the same symbol + val e1 = enum.typeParams(0).asType + val TypeBounds(_, TypeRef(_, _, List(TypeRef(_, e2: TypeSymbol, _)))) = e1.typeSignature + println(e1, e2, e1 eq e2) +} \ No newline at end of file diff --git a/test/files/run/t6548.check b/test/files/run/t6548.check index e82cae110a..5dfcb12e02 100644 --- a/test/files/run/t6548.check +++ b/test/files/run/t6548.check @@ -1,2 +1,2 @@ false -List(JavaAnnotationWithNestedEnum(value = VALUE)) +List(JavaAnnotationWithNestedEnum_1(value = VALUE)) diff --git a/test/files/run/t6548.scala b/test/files/run/t6548.scala deleted file mode 100644 index be3eb5b932..0000000000 --- a/test/files/run/t6548.scala +++ /dev/null @@ -1,12 +0,0 @@ -import scala.reflect.runtime.universe._ -import scala.reflect.runtime.{currentMirror => cm} - -class Bean { - @JavaAnnotationWithNestedEnum(JavaAnnotationWithNestedEnum.Value.VALUE) - def value = 1 -} - -object Test extends App { - println(cm.staticClass("Bean").isCaseClass) - println(typeOf[Bean].declaration(newTermName("value")).annotations) -} diff --git a/test/files/run/t6548/JavaAnnotationWithNestedEnum_1.java b/test/files/run/t6548/JavaAnnotationWithNestedEnum_1.java new file mode 100644 index 0000000000..32004de537 --- /dev/null +++ b/test/files/run/t6548/JavaAnnotationWithNestedEnum_1.java @@ -0,0 +1,17 @@ +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.ANNOTATION_TYPE, ElementType.METHOD, ElementType.FIELD, + ElementType.TYPE, ElementType.PARAMETER}) +@Retention(RetentionPolicy.RUNTIME) +public @interface JavaAnnotationWithNestedEnum_1 +{ + public Value value() default Value.VALUE; + + public enum Value + { + VALUE; + } +} \ No newline at end of file diff --git a/test/files/run/t6548/Test_2.scala b/test/files/run/t6548/Test_2.scala new file mode 100644 index 0000000000..6e4f6ba92a --- /dev/null +++ b/test/files/run/t6548/Test_2.scala @@ -0,0 +1,12 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} + +class Bean { + @JavaAnnotationWithNestedEnum_1(JavaAnnotationWithNestedEnum_1.Value.VALUE) + def value = 1 +} + +object Test extends App { + println(cm.staticClass("Bean").isCaseClass) + println(typeOf[Bean].declaration(newTermName("value")).annotations) +} diff --git a/test/files/run/t7008/Impls_Macros_1.scala b/test/files/run/t7008/Impls_Macros_1.scala deleted file mode 100644 index f2eb7425f5..0000000000 --- a/test/files/run/t7008/Impls_Macros_1.scala +++ /dev/null @@ -1,12 +0,0 @@ -import language.experimental.macros -import scala.reflect.macros.Context - -object Macros { - def impl(c: Context) = { - val decls = c.typeOf[JavaClassWithCheckedExceptions[_]].declarations.toList - val s = decls.sortBy(_.name.toString).map(decl => (s"${decl.name}: ${decl.annotations}")).mkString(scala.compat.Platform.EOL) - c.universe.reify(println(c.literal(s).splice)) - } - - def foo = macro impl -} \ No newline at end of file diff --git a/test/files/run/t7008/Impls_Macros_2.scala b/test/files/run/t7008/Impls_Macros_2.scala new file mode 100644 index 0000000000..7a17314085 --- /dev/null +++ b/test/files/run/t7008/Impls_Macros_2.scala @@ -0,0 +1,12 @@ +import language.experimental.macros +import scala.reflect.macros.Context + +object Macros { + def impl(c: Context) = { + val decls = c.typeOf[JavaClassWithCheckedExceptions_1[_]].declarations.toList + val s = decls.sortBy(_.name.toString).map(decl => (s"${decl.name}: ${decl.annotations}")).mkString(scala.compat.Platform.EOL) + c.universe.reify(println(c.literal(s).splice)) + } + + def foo = macro impl +} \ No newline at end of file diff --git a/test/files/run/t7008/JavaClassWithCheckedExceptions_1.java b/test/files/run/t7008/JavaClassWithCheckedExceptions_1.java new file mode 100644 index 0000000000..dda2128302 --- /dev/null +++ b/test/files/run/t7008/JavaClassWithCheckedExceptions_1.java @@ -0,0 +1,7 @@ +class JavaClassWithCheckedExceptions_1 { + public JavaClassWithCheckedExceptions_1() throws NullPointerException {} + + public void bar() throws E1 {} + public void baz(int x) throws IllegalStateException {} + public void foo() throws E2 {} +} \ No newline at end of file diff --git a/test/files/run/t7008/Test_2.scala b/test/files/run/t7008/Test_2.scala deleted file mode 100644 index b67faa327f..0000000000 --- a/test/files/run/t7008/Test_2.scala +++ /dev/null @@ -1,9 +0,0 @@ -import scala.reflect.runtime.universe._ - -object Test extends App { - Macros.foo - println("=============") - - val decls = typeOf[JavaClassWithCheckedExceptions[_]].declarations.toList - decls sortBy (_.name.toString) foreach (decl => println(s"${decl.name}: ${decl.annotations}")) -} \ No newline at end of file diff --git a/test/files/run/t7008/Test_3.scala b/test/files/run/t7008/Test_3.scala new file mode 100644 index 0000000000..b2961a829e --- /dev/null +++ b/test/files/run/t7008/Test_3.scala @@ -0,0 +1,9 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + Macros.foo + println("=============") + + val decls = typeOf[JavaClassWithCheckedExceptions_1[_]].declarations.toList + decls sortBy (_.name.toString) foreach (decl => println(s"${decl.name}: ${decl.annotations}")) +} \ No newline at end of file -- cgit v1.2.3