diff options
Diffstat (limited to 'org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileReaderTest_1_8.java')
-rw-r--r-- | org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileReaderTest_1_8.java | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileReaderTest_1_8.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileReaderTest_1_8.java index f63069d47..7f3a61ea9 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileReaderTest_1_8.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileReaderTest_1_8.java @@ -43,13 +43,13 @@ public class ClassFileReaderTest_1_8 extends AbstractRegressionTest { public ClassFileReaderTest_1_8(String name) { super(name); } - + // Needed to run tests individually from JUnit protected void setUp() throws Exception { super.setUp(); this.complianceLevel = ClassFileConstants.JDK1_8; } - + public void test001_classTypeParameter() throws Exception { String source = "import java.lang.annotation.*;\n" + @@ -65,14 +65,14 @@ public class ClassFileReaderTest_1_8 extends AbstractRegressionTest { "}"; org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader classFileReader = getInternalClassFile("", "X", "X", source); - + IBinaryTypeAnnotation[] typeAnnotations = classFileReader.getTypeAnnotations(); assertEquals(2,typeAnnotations.length); - + assertEquals("@LFoo; CLASS_TYPE_PARAMETER(type_parameter_index=0)", printTypeAnnotation(typeAnnotations[0])); assertEquals("@LBar;(iii=(int)99) CLASS_TYPE_PARAMETER(type_parameter_index=1)", printTypeAnnotation(typeAnnotations[1])); } - + public void test001a_classTypeParameterDifferingRetentions() throws Exception { String source = "import java.lang.annotation.*;\n" + @@ -88,19 +88,19 @@ public class ClassFileReaderTest_1_8 extends AbstractRegressionTest { "}"; org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader classFileReader = getInternalClassFile("", "X", "X", source); - + IBinaryTypeAnnotation[] typeAnnotations = classFileReader.getTypeAnnotations(); assertEquals(2,typeAnnotations.length); - + assertEquals("@LBar;(iii=(int)99) CLASS_TYPE_PARAMETER(type_parameter_index=1)", printTypeAnnotation(typeAnnotations[0])); assertEquals("@LFoo; CLASS_TYPE_PARAMETER(type_parameter_index=0)", printTypeAnnotation(typeAnnotations[1])); } - + public void test002_methodTypeParameter() throws Exception { String source = "import java.lang.annotation.*;\n" + "public class X {\n" + - " <@Foo T1, @Bar(3) T2> void foo(T1 t1,T2 t2) {}\n" + + " <@Foo T1, @Bar(3) T2> void foo(T1 t1,T2 t2) {}\n" + "}\n" + "@Retention(RetentionPolicy.CLASS)\n" + "@Target(ElementType.TYPE_USE)\n" + @@ -113,7 +113,7 @@ public class ClassFileReaderTest_1_8 extends AbstractRegressionTest { "}"; org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader cfr = getInternalClassFile("", "X", "X", source); - + IBinaryMethod method = getMethod(cfr,"foo"); assertNotNull(method); IBinaryTypeAnnotation[] typeAnnotations = method.getTypeAnnotations(); @@ -122,7 +122,7 @@ public class ClassFileReaderTest_1_8 extends AbstractRegressionTest { assertEquals("@LFoo; METHOD_TYPE_PARAMETER(type_parameter_index=0)",printTypeAnnotation(typeAnnotations[0])); assertEquals("@LBar;(value=(int)3) METHOD_TYPE_PARAMETER(type_parameter_index=1)",printTypeAnnotation(typeAnnotations[1])); } - + public void test003_classExtends() throws Exception { this.complianceLevel = ClassFileConstants.JDK1_8; String source = @@ -140,7 +140,7 @@ public class ClassFileReaderTest_1_8 extends AbstractRegressionTest { "}"; org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader classFileReader = getInternalClassFile("", "X", "X", source); - + IBinaryTypeAnnotation[] typeAnnotations = classFileReader.getTypeAnnotations(); assertEquals(3,typeAnnotations.length); assertEquals("@LFoo; CLASS_EXTENDS(type_index=-1)", printTypeAnnotation(typeAnnotations[0])); @@ -166,14 +166,14 @@ public class ClassFileReaderTest_1_8 extends AbstractRegressionTest { "}"; org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader classFileReader = getInternalClassFile("", "X", "X", source); - + IBinaryTypeAnnotation[] typeAnnotations = classFileReader.getTypeAnnotations(); assertEquals(3,typeAnnotations.length); assertEquals("@LFoo; CLASS_EXTENDS(type_index=-1), location=[TYPE_ARGUMENT(0)]", printTypeAnnotation(typeAnnotations[0])); assertEquals("@LBar; CLASS_EXTENDS(type_index=-1), location=[TYPE_ARGUMENT(1)]", printTypeAnnotation(typeAnnotations[1])); assertEquals("@LFoo; CLASS_EXTENDS(type_index=0), location=[TYPE_ARGUMENT(0)]", printTypeAnnotation(typeAnnotations[2])); } - + public void test005_classTypeParameterBound() throws Exception { String source = "import java.lang.annotation.*;\n" + @@ -190,7 +190,7 @@ public class ClassFileReaderTest_1_8 extends AbstractRegressionTest { "}"; org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader classFileReader = getInternalClassFile("", "X", "X", source); - + IBinaryTypeAnnotation[] typeAnnotations = classFileReader.getTypeAnnotations(); assertEquals(4,typeAnnotations.length); assertEquals("@LFoo; CLASS_TYPE_PARAMETER_BOUND(type_parameter_index=1, bound_index=0), location=[TYPE_ARGUMENT(0), ARRAY, ARRAY, ARRAY]", printTypeAnnotation(typeAnnotations[0])); @@ -198,7 +198,7 @@ public class ClassFileReaderTest_1_8 extends AbstractRegressionTest { assertEquals("@LBar;(value=(int)2) CLASS_TYPE_PARAMETER_BOUND(type_parameter_index=1, bound_index=0), location=[TYPE_ARGUMENT(0), ARRAY, ARRAY]", printTypeAnnotation(typeAnnotations[2])); assertEquals("@LBar;(value=(int)3) CLASS_TYPE_PARAMETER_BOUND(type_parameter_index=1, bound_index=1)", printTypeAnnotation(typeAnnotations[3])); } - + public void test006_methodTypeParameterBound() throws Exception { String source = "import java.lang.annotation.*;\n" + @@ -229,7 +229,7 @@ public class ClassFileReaderTest_1_8 extends AbstractRegressionTest { assertEquals("@LBar;(value=(int)2) METHOD_TYPE_PARAMETER_BOUND(type_parameter_index=0, bound_index=0), location=[TYPE_ARGUMENT(0), ARRAY, ARRAY]", printTypeAnnotation(typeAnnotations[2])); assertEquals("@LBar;(value=(int)3) METHOD_TYPE_PARAMETER_BOUND(type_parameter_index=0, bound_index=1)", printTypeAnnotation(typeAnnotations[3])); } - + public void test007_field() throws Exception { String source = "import java.lang.annotation.*;\n" + @@ -263,7 +263,7 @@ public class ClassFileReaderTest_1_8 extends AbstractRegressionTest { assertEquals("@LBar;(value=(int)4) FIELD, location=[TYPE_ARGUMENT(1), ARRAY]", printTypeAnnotation(typeAnnotations[4])); assertEquals("@LBar;(value=(int)5) FIELD, location=[TYPE_ARGUMENT(1), ARRAY, ARRAY]", printTypeAnnotation(typeAnnotations[5])); } - + public void test008_methodReturn() throws Exception { String source = "import java.lang.annotation.*;\n" + @@ -271,10 +271,10 @@ public class ClassFileReaderTest_1_8 extends AbstractRegressionTest { "public class X{\n" + " @Bar(3) @Foo int foo() {\n" + " return 1;\n" + - " }\n" + + " }\n" + " @Bar(3) int @Foo [] foo2() {\n" + " return null;\n" + - " }\n" + + " }\n" + "}\n" + "@Retention(RetentionPolicy.CLASS)\n" + "@Target(ElementType.TYPE_USE)\n" + @@ -295,7 +295,7 @@ public class ClassFileReaderTest_1_8 extends AbstractRegressionTest { assertEquals(2,typeAnnotations.length); assertEquals("@LBar;(value=(int)3) METHOD_RETURN",printTypeAnnotation(typeAnnotations[0])); assertEquals("@LFoo; METHOD_RETURN", printTypeAnnotation(typeAnnotations[1])); - + method = getMethod(cfr,"foo2"); assertNotNull(method); typeAnnotations = method.getTypeAnnotations(); @@ -304,13 +304,13 @@ public class ClassFileReaderTest_1_8 extends AbstractRegressionTest { assertEquals("@LBar;(value=(int)3) METHOD_RETURN, location=[ARRAY]",printTypeAnnotation(typeAnnotations[0])); assertEquals("@LFoo; METHOD_RETURN", printTypeAnnotation(typeAnnotations[1])); } - + public void test009_methodReceiver() throws Exception { String source = "import java.lang.annotation.*;\n" + "import java.util.Map;\n" + "public class X{\n" + - " void foo(@Bar(3) X this) {}\n" + + " void foo(@Bar(3) X this) {}\n" + "}\n" + "@Retention(RetentionPolicy.CLASS)\n" + "@Target(ElementType.TYPE_USE)\n" + @@ -331,13 +331,13 @@ public class ClassFileReaderTest_1_8 extends AbstractRegressionTest { assertEquals(1,typeAnnotations.length); assertEquals("@LBar;(value=(int)3) METHOD_RECEIVER", printTypeAnnotation(typeAnnotations[0])); } - + public void test010_methodFormalParameter() throws Exception { String source = "import java.lang.annotation.*;\n" + "import java.util.Map;\n" + "public class X{\n" + - " void foo(@Bar(3) String s, @Foo int i) {}\n" + + " void foo(@Bar(3) String s, @Foo int i) {}\n" + "}\n" + "@Retention(RetentionPolicy.CLASS)\n" + "@Target(ElementType.TYPE_USE)\n" + @@ -359,13 +359,13 @@ public class ClassFileReaderTest_1_8 extends AbstractRegressionTest { assertEquals("@LBar;(value=(int)3) METHOD_FORMAL_PARAMETER(method_formal_parameter_index=0)",printTypeAnnotation(typeAnnotations[0])); assertEquals("@LFoo; METHOD_FORMAL_PARAMETER(method_formal_parameter_index=1)",printTypeAnnotation(typeAnnotations[1])); } - + public void test011_throws() throws Exception { String source = "import java.lang.annotation.*;\n" + "import java.util.Map;\n" + "public class X{\n" + - " void foo() throws @Foo Exception, @Bar(1) Throwable {}\n" + + " void foo() throws @Foo Exception, @Bar(1) Throwable {}\n" + "}\n" + "@Retention(RetentionPolicy.CLASS)\n" + "@Target(ElementType.TYPE_USE)\n" + @@ -392,9 +392,9 @@ public class ClassFileReaderTest_1_8 extends AbstractRegressionTest { "import java.lang.annotation.*;\n" + "import java.util.Map;\n" + "public @interface X{\n" + - " @Bar(3) @Foo int foo();\n" + - " @Bar(3) int @Foo [] foo2();\n" + - " @Bar(7) @Foo String value() default \"aaa\";\n" + + " @Bar(3) @Foo int foo();\n" + + " @Bar(3) int @Foo [] foo2();\n" + + " @Bar(7) @Foo String value() default \"aaa\";\n" + "}\n" + "@Retention(RetentionPolicy.CLASS)\n" + "@Target(ElementType.TYPE_USE)\n" + @@ -415,7 +415,7 @@ public class ClassFileReaderTest_1_8 extends AbstractRegressionTest { assertEquals(2,typeAnnotations.length); assertEquals("@LBar;(value=(int)3) METHOD_RETURN",printTypeAnnotation(typeAnnotations[0])); assertEquals("@LFoo; METHOD_RETURN", printTypeAnnotation(typeAnnotations[1])); - + method = getMethod(cfr,"foo2"); assertNotNull(method); typeAnnotations = method.getTypeAnnotations(); @@ -423,7 +423,7 @@ public class ClassFileReaderTest_1_8 extends AbstractRegressionTest { assertEquals(2,typeAnnotations.length); assertEquals("@LBar;(value=(int)3) METHOD_RETURN, location=[ARRAY]",printTypeAnnotation(typeAnnotations[0])); assertEquals("@LFoo; METHOD_RETURN", printTypeAnnotation(typeAnnotations[1])); - + method = getMethod(cfr,"value"); assertNotNull(method); typeAnnotations = method.getTypeAnnotations(); @@ -454,12 +454,12 @@ public class ClassFileReaderTest_1_8 extends AbstractRegressionTest { runConformTest( new String[] { "j/Usage.java", - "package j;\n" + - "\n" + - "import k.A.B.C;\n" + - "\n" + - "public class Usage {\n" + - " C c;\n" + + "package j;\n" + + "\n" + + "import k.A.B.C;\n" + + "\n" + + "public class Usage {\n" + + " C c;\n" + "}" }, "", @@ -491,7 +491,7 @@ public class ClassFileReaderTest_1_8 extends AbstractRegressionTest { sb.append(')'); } sb.append(' '); - + // target type int targetType = typeAnnotation.getTargetType(); switch (targetType) { @@ -535,10 +535,10 @@ public class ClassFileReaderTest_1_8 extends AbstractRegressionTest { break; default: throw new IllegalStateException("nyi "+targetType); } - + // location int[] typepath = typeAnnotation.getTypePath(); - + if (typepath != IBinaryTypeAnnotation.NO_TYPE_PATH) { sb.append(", location=["); //$NON-NLS-1$ for (int i = 0, max = typepath.length; i < max; i += 2) { @@ -592,5 +592,5 @@ public class ClassFileReaderTest_1_8 extends AbstractRegressionTest { } return null; } - + } |