diff options
author | Till Brychcy | 2017-04-14 11:30:46 +0000 |
---|---|---|
committer | Till Brychcy | 2017-04-14 19:40:45 +0000 |
commit | fe52650a61fccd4273defc59b15afbb82a1f49cf (patch) | |
tree | dbb079f22fdf8e6db9a906f6baf2c4a0e60510c2 | |
parent | 33c2bbf0853e7d7634881ee1cdbec339eec8d40e (diff) | |
download | eclipse.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
String"
Change-Id: I49707a65af2038e2a00d6e70a5d789f6931fd1be
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; } |