Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTill Brychcy2017-04-14 11:30:46 +0000
committerTill Brychcy2017-04-14 19:40:45 +0000
commitfe52650a61fccd4273defc59b15afbb82a1f49cf (patch)
treedbb079f22fdf8e6db9a906f6baf2c4a0e60510c2
parent33c2bbf0853e7d7634881ee1cdbec339eec8d40e (diff)
downloadeclipse.jdt.core-fe52650a61fccd4273defc59b15afbb82a1f49cf.tar.gz
eclipse.jdt.core-fe52650a61fccd4273defc59b15afbb82a1f49cf.tar.xz
eclipse.jdt.core-fe52650a61fccd4273defc59b15afbb82a1f49cf.zip
Bug 515292 - [1.8][null] Don't report warning for "T extends @Nullable
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullTypeAnnotationTest.java26
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java4
2 files changed, 29 insertions, 1 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 f93b5980d1..30e7c01575 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
@@ -15349,4 +15349,30 @@ public void testBug514977() {
"----------\n"
);
}
+public void testBug515292() {
+ runConformTestWithLibs(
+ new String[] {
+ "test/BoundedByFinal.java",
+ "package test;\n" +
+ "import org.eclipse.jdt.annotation.NonNull;\n" +
+ "import org.eclipse.jdt.annotation.Nullable;\n" +
+ "\n" +
+ "public abstract class BoundedByFinal {\n" +
+ " abstract <T extends @Nullable String> void setSelection(T[] selectedObjects);\n" +
+ "\n" +
+ " abstract @NonNull String @NonNull [] toArray1();\n" +
+ "\n" +
+ " abstract @Nullable String @NonNull [] toArray2();\n" +
+ "\n" +
+ " void test() {\n" +
+ " setSelection(toArray1());\n" +
+ " setSelection(toArray2());\n" +
+ " }\n" +
+ "}\n" +
+ "",
+ },
+ getCompilerOptions(),
+ ""
+ );
+}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java
index f0cd3c24ff..1a9997b771 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java
@@ -894,7 +894,9 @@ public abstract class Scope {
break;
default :
if (((ReferenceBinding) superType).isFinal()) {
- problemReporter().finalVariableBound(typeVariable, typeRef);
+ if (!environment().usesNullTypeAnnotations() || (superType.tagBits & TagBits.AnnotationNullable) == 0) {
+ problemReporter().finalVariableBound(typeVariable, typeRef);
+ }
}
break;
}

Back to the top