Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2019-03-26 19:07:24 +0000
committerTill Brychcy2019-03-26 20:29:35 +0000
commitb38c9e37927a5708f610bef4d6a255ce71a53468 (patch)
treec129442b638e6c7ce84acc4b4ff4fbf78378e829 /org.eclipse.jdt.core.tests.compiler/src
parent716dc3e8bf36c9398625bc368b0e0fde4379794d (diff)
downloadeclipse.jdt.core-b38c9e37927a5708f610bef4d6a255ce71a53468.tar.gz
eclipse.jdt.core-b38c9e37927a5708f610bef4d6a255ce71a53468.tar.xz
eclipse.jdt.core-b38c9e37927a5708f610bef4d6a255ce71a53468.zip
Bug 541772 - In Eclipse 2018-09, Maven "runtime" scoped dependenciesI20190327-1800
cause compilation errors even when not used - make test even meaner and implementation even safer Change-Id: I1c0db4a74ff39f946d28290b7e4fff2fb619b1db
Diffstat (limited to 'org.eclipse.jdt.core.tests.compiler/src')
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java88
1 files changed, 88 insertions, 0 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java
index 6a2b6438dc..20da9ff124 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java
@@ -52498,4 +52498,92 @@ public void testBug541772() {
getCompilerOptions(),
null /*customRequestor*/);
}
+public void testBug541772_typeannotations() {
+ if (this.complianceLevel < ClassFileConstants.JDK1_8) {
+ return;
+ }
+ runConformTest(
+ new String[] {
+ "bug541772Runtime/GeneratedMessage.java",
+ "package bug541772Runtime;\n" +
+ "\n" +
+ "public class GeneratedMessage {\n" +
+ " public class Builder<T> {\n" +
+ " }\n" +
+ "}\n" +
+ "",
+ },
+ "",
+ getCompilerOptions()
+ );
+
+ runConformTest(
+ new String[] {
+ "token/Ann.java",
+ "package token;\n" +
+ "import java.lang.annotation.*;\n" +
+ "@Target(ElementType.TYPE_USE)\n" +
+ "@Retention(RetentionPolicy.CLASS)\n" +
+ "@interface Ann {}\n",
+ "token/Token.java",
+ "package token;\n" +
+ "\n" +
+ "public class Token {\n" +
+ " \n" +
+ " public Token() {\n" +
+ " }\n" +
+ "\n" +
+ " public Token(TokenProto tokenPB) {\n" +
+ " tokenPB.hashCode();\n" +
+ " }\n" +
+ " public Token(String x) {\n" +
+ " x.hashCode();\n" +
+ " }\n" +
+ "}\n" +
+ "",
+ "token/TokenProto.java",
+ "package token;\n" +
+ "\n" +
+ "import bug541772Runtime.GeneratedMessage;\n" +
+ "\n" +
+ "public class TokenProto {\n" +
+ "\n" +
+ " public TokenProto(GeneratedMessage.@Ann Builder<?> builder) {\n" +
+ " builder.hashCode();\n" +
+ " }\n" +
+ "}\n" +
+ "",
+ },
+ "",
+ null /*classLibraries*/,
+ false /*shouldFlushOutputDirectory*/,
+ null /*vmArguments*/,
+ getCompilerOptions(),
+ null /*customRequestor*/);
+
+ Util.flushDirectoryContent(new File(OUTPUT_DIR + File.separator + "bug541772Runtime"));
+
+ Map compilerOptions = getCompilerOptions();
+ compilerOptions.put(JavaCore.COMPILER_ANNOTATION_NULL_ANALYSIS, JavaCore.ENABLED);
+ runConformTest(
+ new String[] {
+ "pkg/Example.java",
+ "package pkg;\n" +
+ "\n" +
+ "import token.Token;\n" +
+ "\n" +
+ "public abstract class Example {\n" +
+ " public static void setConnectorInfo() {\n" +
+ " new Token(\"\");\n" +
+ " }\n" +
+ "}\n" +
+ "",
+ },
+ "",
+ null /*classLibraries*/,
+ false /*shouldFlushOutputDirectory*/,
+ null /*vmArguments*/,
+ compilerOptions,
+ null /*customRequestor*/);
+}
}

Back to the top