Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2019-07-21 16:48:58 +0000
committerStephan Herrmann2019-07-21 17:26:40 +0000
commit8b588a9d392b6205c522afd3bab1d988cf547452 (patch)
tree125ab3f6e62a2b5bd871cc1425338697aa3759c4 /org.eclipse.jdt.core.tests.compiler
parent3743aeb68ad9de418fe4dbe9c2dec82e8e65fc8d (diff)
downloadeclipse.jdt.core-8b588a9d392b6205c522afd3bab1d988cf547452.tar.gz
eclipse.jdt.core-8b588a9d392b6205c522afd3bab1d988cf547452.tar.xz
eclipse.jdt.core-8b588a9d392b6205c522afd3bab1d988cf547452.zip
Bug 543778 - [10][compiler] NPE in 4.10 when compiling Lambda ExpressionI20190722-1800I20190721-1800
Diffstat (limited to 'org.eclipse.jdt.core.tests.compiler')
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LambdaRegressionTest.java44
1 files changed, 43 insertions, 1 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LambdaRegressionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LambdaRegressionTest.java
index 7e265433b5..b13e295c33 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LambdaRegressionTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LambdaRegressionTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2015, 2018 IBM Corporation and others.
+ * Copyright (c) 2015, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -15,6 +15,7 @@
*******************************************************************************/
package org.eclipse.jdt.core.tests.compiler.regression;
+import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest.JavacTestOptions.EclipseHasABug;
import org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest.JavacTestOptions.JavacHasABug;
@@ -1121,6 +1122,47 @@ public void testBug511676a() {
},
"Done");
}
+public void testBug543778() {
+ Runner runner = new Runner();
+ runner.testFiles =
+ new String[] {
+ "Sandbox.java",
+ "import java.util.function.Supplier;\n" +
+ "\n" +
+ "public class Sandbox {\n" +
+ "\n" +
+ " <R extends Object> R get(Supplier<@NonNull R> impl) {\n" +
+ " return null;\n" +
+ " }\n" +
+ "\n" +
+ " Object getter() {\n" +
+ " return get(() -> new Object() {\n" +
+ "\n" +
+ " @Override\n" +
+ " public String toString() {\n" +
+ " return super.toString();\n" +
+ " }\n" +
+ "\n" +
+ " });\n" +
+ " }\n" +
+ "\n" +
+ "}\n",
+ "NonNull.java",
+ "import java.lang.annotation.ElementType;\n" +
+ "import java.lang.annotation.Retention;\n" +
+ "import java.lang.annotation.RetentionPolicy;\n" +
+ "import java.lang.annotation.Target;\n" +
+ "\n" +
+ "@Retention(RetentionPolicy.CLASS)\n" +
+ "@Target({ ElementType.TYPE_USE })\n" +
+ "public @interface NonNull {\n" +
+ " // marker annotation with no members\n" +
+ "}\n",
+ };
+ runner.customOptions = getCompilerOptions();
+ runner.customOptions.put(JavaCore.COMPILER_ANNOTATION_NULL_ANALYSIS, JavaCore.ENABLED); // bug happens due to type annotation handling
+ runner.runConformTest();
+}
public static Class testClass() {
return LambdaRegressionTest.class;
}

Back to the top