Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2020-03-29 00:12:55 +0000
committerStephan Herrmann2020-03-29 00:12:55 +0000
commitf45640e68f703e4e86cce5d8659260815b7ac0c1 (patch)
treeea9524e53c375277d2b3f7887e14c8e43b97817f
parent11bfdeef6d0486b1e737526983b27922b011a974 (diff)
downloadeclipse.jdt.core-f45640e68f703e4e86cce5d8659260815b7ac0c1.tar.gz
eclipse.jdt.core-f45640e68f703e4e86cce5d8659260815b7ac0c1.tar.xz
eclipse.jdt.core-f45640e68f703e4e86cce5d8659260815b7ac0c1.zip
Bug 561549 - [1.8][annotation] javac no longer complains about type
annotation on static type part - add an EclipseJustification Change-Id: I8ba7c5a8ab8a22ce1ad43d68990d04625a8b57ae
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java9
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeTypeAnnotationTest.java21
2 files changed, 23 insertions, 7 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java
index 62e60dd46d..0e2e2490db 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java
@@ -875,7 +875,14 @@ protected static class JavacTestOptions {
EclipseBug235546 = RUN_JAVAC ? // https://bugs.eclipse.org/bugs/show_bug.cgi?id=235546
new EclipseJustification(MismatchType.JavacErrorsEclipseNone) : null,
EclipseBug449063 = RUN_JAVAC ? // https://bugs.eclipse.org/bugs/show_bug.cgi?id=449063
- new EclipseJustification(MismatchType.StandardOutputMismatch) : null;
+ new EclipseJustification(MismatchType.StandardOutputMismatch) : null,
+ EclipseBug561549 = RUN_JAVAC ? // https://bugs.eclipse.org/bugs/show_bug.cgi?id=561549
+ new EclipseJustification(MismatchType.EclipseErrorsJavacNone) {
+ @Override
+ Excuse excuseFor(JavacCompiler compiler) {
+ return compiler.compliance > ClassFileConstants.JDK9 ? this : null;
+ }
+ } : null;
public static final EclipseJustification
EclipseJustification0001 = RUN_JAVAC ?
new EclipseJustification(MismatchType.EclipseErrorsJavacNone) {
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeTypeAnnotationTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeTypeAnnotationTest.java
index 31d0de2eda..dee08ac969 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeTypeAnnotationTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeTypeAnnotationTest.java
@@ -16,6 +16,7 @@ package org.eclipse.jdt.core.tests.compiler.regression;
import java.io.File;
import java.util.Map;
+import org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest.JavacTestOptions.EclipseJustification;
import org.eclipse.jdt.core.util.ClassFileBytesDisassembler;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
@@ -3564,7 +3565,8 @@ public class NegativeTypeAnnotationTest extends AbstractRegressionTest {
// This test case is similar to test415308a. SimpleTypes on which annotations are applied are modified to array
// types.
public void test415308b2() {
- this.runNegativeTest(
+ Runner runner = new Runner();
+ runner.testFiles =
new String[] {
"X.java",
"import java.lang.annotation.ElementType;\n" +
@@ -3594,13 +3596,16 @@ public class NegativeTypeAnnotationTest extends AbstractRegressionTest {
" return z;\n" +
" }\n" +
"}\n"
- },
+ };
+ runner.expectedCompilerLog =
"----------\n" +
"1. ERROR in X.java (at line 16)\n" +
" @Illegal Y.YY.Z[] z = null;\n" +
" ^^^^^^^^\n" +
"Type annotations are not allowed on type names used to access static members\n" +
- "----------\n");
+ "----------\n";
+ runner.javacTestOptions = EclipseJustification.EclipseBug561549;
+ runner.runNegativeTest();
}
// [1.8][compiler] Illegal type annotations not rejected (https://bugs.eclipse.org/bugs/show_bug.cgi?id=415308)
// The test case is to validate that we report errors for only type annotations and nothing else in case of
@@ -3773,7 +3778,8 @@ public class NegativeTypeAnnotationTest extends AbstractRegressionTest {
// [1.8][compiler] Illegal type annotations not rejected (https://bugs.eclipse.org/bugs/show_bug.cgi?id=415308)
// The test case is a array version of test415308f.
public void test415308f2() {
- this.runNegativeTest(
+ Runner runner = new Runner();
+ runner.testFiles =
new String[] {
"X.java",
"import java.lang.annotation.ElementType;\n" +
@@ -3790,13 +3796,16 @@ public class NegativeTypeAnnotationTest extends AbstractRegressionTest {
"class X {\n" +
" public @Illegal Y.Z[] foo() { return null;}\n" +
"}\n"
- },
+ };
+ runner.expectedCompilerLog =
"----------\n" +
"1. ERROR in X.java (at line 13)\n" +
" public @Illegal Y.Z[] foo() { return null;}\n" +
" ^^^^^^^^\n" +
"Type annotations are not allowed on type names used to access static members\n" +
- "----------\n");
+ "----------\n";
+ runner.javacTestOptions = EclipseJustification.EclipseBug561549;
+ runner.runNegativeTest();
}
// [1.8][compiler] Illegal type annotations not rejected (https://bugs.eclipse.org/bugs/show_bug.cgi?id=415308)
// The test case is used to test enums with type annotations.

Back to the top