diff options
author | Stephan Herrmann | 2018-04-12 12:30:38 +0000 |
---|---|---|
committer | Stephan Herrmann | 2018-04-12 12:30:38 +0000 |
commit | 31741455f7734baa875218b1fcf89d9bda1e81c4 (patch) | |
tree | 5cff10844d96cabeffdf83991a632942bebb4d13 | |
parent | e60c4f1f36f7efd5fbc1bbc661872b78c6939230 (diff) | |
download | eclipse.jdt.core-31741455f7734baa875218b1fcf89d9bda1e81c4.tar.gz eclipse.jdt.core-31741455f7734baa875218b1fcf89d9bda1e81c4.tar.xz eclipse.jdt.core-31741455f7734baa875218b1fcf89d9bda1e81c4.zip |
Bug 533488 - [9] @Deprecated may cause AIOOBEI20180416-2000I20180416-0305I20180415-2000I20180414-1500I20180413-2000I20180412-2000
Follow-up:
- integrate new test into the regression suite
- move existing related tests to the new test class
- remove bogus/redundant compliance checks
- avoid rawtypes rather than suppressing the warning
Change-Id: I641165fa68548e5b7f06f999ba87fdd8d57d3cb1
3 files changed, 58 insertions, 73 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java index 40190d234c..d5a27a8e67 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java @@ -11866,69 +11866,4 @@ public void testBug506888f() throws Exception { assertEquals(1, requestor.problemArguments.length); assertEquals(JavaCore.COMPILER_PB_UNUSED_PARAMETER, requestor.problemArguments[0]); } -public void testBug521054a() throws Exception { - if (this.complianceLevel <= ClassFileConstants.JDK1_8) { - return; - } - this.runNegativeTest( - new String[] { - "X.java", - "public @interface X {\n" + - " String value(X this);\n" + - "}\n", - }, - "----------\n" + - "1. ERROR in X.java (at line 2)\n" + - " String value(X this);\n" + - " ^^^^^^^^^^^^^\n" + - "Annotation attributes cannot have parameters\n" + - "----------\n", - null, true); -} -public void testBug521054b() throws Exception { - if (this.complianceLevel <= ClassFileConstants.JDK1_8) { - return; - } - this.runNegativeTest( - new String[] { - "X.java", - "@java.lang.annotation.Repeatable(Container.class)\n" + - "public @interface X {\n" + - " String value();\n" + - "}\n" + - "@interface Container {\n" + - " X[] value(Container this);\n" + - "}\n", - }, - "----------\n" + - "1. ERROR in X.java (at line 6)\n" + - " X[] value(Container this);\n" + - " ^^^^^^^^^^^^^^^^^^^^^\n" + - "Annotation attributes cannot have parameters\n" + - "----------\n", - null, true); -} -public void testBug521054c() throws Exception { - if (this.complianceLevel <= ClassFileConstants.JDK1_8) { - return; - } - this.runNegativeTest( - new String[] { - "X.java", - "@java.lang.annotation.Repeatable(Container.class)\n" + - "public @interface X {\n" + - " String value(X this, int i);\n" + - "}\n" + - "@interface Container {\n" + - " X[] value();\n" + - "}\n", - }, - "----------\n" + - "1. ERROR in X.java (at line 3)\n" + - " String value(X this, int i);\n" + - " ^^^^^^^^^^^^^^^^^^^^\n" + - "Annotation attributes cannot have parameters\n" + - "----------\n", - null, true); -} } diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest_9.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest_9.java index 27dbb974b6..a2aff1917b 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest_9.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest_9.java @@ -8,11 +8,9 @@ *******************************************************************************/ package org.eclipse.jdt.core.tests.compiler.regression; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import junit.framework.Test; -@SuppressWarnings({ "rawtypes" }) public class AnnotationTest_9 extends AbstractComparableTest { public AnnotationTest_9(String name) { @@ -23,16 +21,11 @@ public class AnnotationTest_9 extends AbstractComparableTest { return buildMinimalComplianceTestSuite(testClass(), F_9); } - public static Class testClass() { + public static Class<?> testClass() { return AnnotationTest_9.class; } public void testBug532913() throws Exception { - this.complianceLevel = ClassFileConstants.JDK9; - if (this.complianceLevel < ClassFileConstants.JDK9) { - return; - } - runConformTest( new String[] { "p/A.java", @@ -51,4 +44,60 @@ public class AnnotationTest_9 extends AbstractComparableTest { "}\n", },"", null, false, null); } + public void testBug521054a() throws Exception { + this.runNegativeTest( + new String[] { + "X.java", + "public @interface X {\n" + + " String value(X this);\n" + + "}\n", + }, + "----------\n" + + "1. ERROR in X.java (at line 2)\n" + + " String value(X this);\n" + + " ^^^^^^^^^^^^^\n" + + "Annotation attributes cannot have parameters\n" + + "----------\n", + null, true); + } + public void testBug521054b() throws Exception { + this.runNegativeTest( + new String[] { + "X.java", + "@java.lang.annotation.Repeatable(Container.class)\n" + + "public @interface X {\n" + + " String value();\n" + + "}\n" + + "@interface Container {\n" + + " X[] value(Container this);\n" + + "}\n", + }, + "----------\n" + + "1. ERROR in X.java (at line 6)\n" + + " X[] value(Container this);\n" + + " ^^^^^^^^^^^^^^^^^^^^^\n" + + "Annotation attributes cannot have parameters\n" + + "----------\n", + null, true); + } + public void testBug521054c() throws Exception { + this.runNegativeTest( + new String[] { + "X.java", + "@java.lang.annotation.Repeatable(Container.class)\n" + + "public @interface X {\n" + + " String value(X this, int i);\n" + + "}\n" + + "@interface Container {\n" + + " X[] value();\n" + + "}\n", + }, + "----------\n" + + "1. ERROR in X.java (at line 3)\n" + + " String value(X this, int i);\n" + + " ^^^^^^^^^^^^^^^^^^^^\n" + + "Annotation attributes cannot have parameters\n" + + "----------\n", + null, true); + } } diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java index fd2f95e98a..b7d17f5a38 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java @@ -163,6 +163,7 @@ public static Test suite() { since_9.add(AutomaticModuleNamingTest.class); since_9.add(UnnamedModuleTest.class); since_9.add(NullAnnotationTests9.class); + since_9.add(AnnotationTest_9.class); // add 10 specific test here (check duplicates) ArrayList since_10 = new ArrayList(); |