Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2014-08-02 12:33:50 +0000
committerStephan Herrmann2014-08-02 12:33:50 +0000
commitcaa8e2c381e9b7346f8392e15cd0656885bb751e (patch)
tree6eac275be75499ef731dd1333179d662d17c9add
parent56632b66e4460fbaf36da5ee9142d7bce0f56a9e (diff)
downloadeclipse.jdt.core-caa8e2c381e9b7346f8392e15cd0656885bb751e.tar.gz
eclipse.jdt.core-caa8e2c381e9b7346f8392e15cd0656885bb751e.tar.xz
eclipse.jdt.core-caa8e2c381e9b7346f8392e15cd0656885bb751e.zip
Bug 439298 - [null] "Missing code implementation in the compiler" when
using @NonNullByDefault in package-info.java
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullTypeAnnotationTest.java58
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java5
2 files changed, 63 insertions, 0 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullTypeAnnotationTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullTypeAnnotationTest.java
index 2c0731ab15..1da4445335 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullTypeAnnotationTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullTypeAnnotationTest.java
@@ -6059,4 +6059,62 @@ public void testBug440773() {
getCompilerOptions(),
"");
}
+public void testBug439298_comment2() {
+ runConformTestWithLibs(
+ new String[] {
+ "Extract.java",
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "\n" +
+ "class R<T> {\n" +
+ " R(@Nullable T t) {}\n" +
+ "}\n" +
+ "class A {}\n" +
+ "@NonNullByDefault\n" +
+ "public class Extract {\n" +
+ " R<A> test() {\n" +
+ " return new R<A>(null);\n" +
+ " }\n" +
+ "}\n"
+ },
+ getCompilerOptions(),
+ "");
+}
+public void testBug439298_comment3() {
+ runConformTestWithLibs(
+ new String[] {
+ "Extract.java",
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "\n" +
+ "class R<T> {\n" +
+ " R(@Nullable T t) {}\n" +
+ "}\n" +
+ "class A {}\n" +
+ "public class Extract {\n" +
+ " R<A> test() {\n" +
+ " return new R<@NonNull A>(null);\n" +
+ " }\n" +
+ "}\n"
+ },
+ getCompilerOptions(),
+ "");
+}
+public void testBug439298_comment4() {
+ runConformTestWithLibs(
+ new String[] {
+ "Extract.java",
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "\n" +
+ "class R<T> {\n" +
+ " R(@Nullable T t) {}\n" +
+ "}\n" +
+ "class A {}\n" +
+ "public class Extract {\n" +
+ " R<@NonNull A> test() {\n" +
+ " return new R<>(null);\n" +
+ " }\n" +
+ "}\n"
+ },
+ getCompilerOptions(),
+ "");
+}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
index f587622426..c4643075ad 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
@@ -52,6 +52,7 @@
* Bug 434600 - Incorrect null analysis error reporting on type parameters
* Bug 439516 - [1.8][null] NonNullByDefault wrongly applied to implicit type bound of binary type
* Bug 438467 - [compiler][null] Better error position for "The method _ cannot implement the corresponding method _ due to incompatible nullness constraints"
+ * Bug 439298 - [null] "Missing code implementation in the compiler" when using @NonNullByDefault in package-info.java
* Jesper S Moller <jesper@selskabet.org> - Contributions for
* bug 382701 - [1.8][compiler] Implement semantic analysis of Lambda expressions & Reference expression
* bug 382721 - [1.8][compiler] Effectively final variables needs special treatment
@@ -3708,6 +3709,10 @@ public void invalidConstructor(Statement statement, MethodBinding targetConstruc
statement.sourceStart,
statement.sourceEnd);
return;
+ case ProblemReasons.ContradictoryNullAnnotations:
+ problemConstructor = (ProblemMethodBinding) targetConstructor;
+ contradictoryNullAnnotationsInferred(problemConstructor.closestMatch, statement);
+ return;
case ProblemReasons.NoError : // 0
default :
needImplementation(statement); // want to fail to see why we were here...

Back to the top