Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2014-08-02 12:33:50 +0000
committerStephan Herrmann2014-08-07 12:19:44 +0000
commit940c4cb4f50cb93adf569e6caf512baa70a8b0b1 (patch)
tree8332e8f2d9a299a248e2b24fac38d4f847463a0f
parent404b4fc38d68f02c11e12cc21a8e792bbe4b0cbe (diff)
downloadeclipse.jdt.core-940c4cb4f50cb93adf569e6caf512baa70a8b0b1.tar.gz
eclipse.jdt.core-940c4cb4f50cb93adf569e6caf512baa70a8b0b1.tar.xz
eclipse.jdt.core-940c4cb4f50cb93adf569e6caf512baa70a8b0b1.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 2f47a69ef5..f78d7c3c96 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
@@ -5767,4 +5767,62 @@ public void testBug435962() {
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 4e1e3b925b..b40a64b150 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
@@ -50,6 +50,7 @@
* Bug 390889 - [1.8][compiler] Evaluate options to support 1.7- projects against 1.8 JRE.
* Bug 430150 - [1.8][null] stricter checking against type variables
* Bug 434600 - Incorrect null analysis error reporting on type parameters
+ * 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
@@ -3705,6 +3706,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