ensure bounds are promoted on derived type otherwise bounds from super could appear on unbounded wildcards (IDEA-162882)

This commit is contained in:
Anna.Kozlova
2016-11-02 15:51:14 +01:00
parent bf259fed79
commit d336733d3e
3 changed files with 39 additions and 6 deletions
@@ -0,0 +1,23 @@
import java.util.Collection;
interface NumberCollection<N extends Number> extends Collection<N> {
}
interface IntegerCollection<I extends Integer> extends NumberCollection<I> {}
interface IntegerCollection1<I extends Integer, L extends I> extends NumberCollection<L> {}
class Test {
<T extends Number, C extends NumberCollection<? extends T>> Collection<T> filter(Collection<C> input) {
return null;
}
public void foo(Collection<IntegerCollection<?>> input) {
Collection<Integer> filtered = filter(input);
}
public void foo1(Collection<IntegerCollection1<?, ?>> input) {
Collection<Integer> filtered = filter(input);
}
}
@@ -21,7 +21,6 @@ import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
import com.intellij.codeInspection.uncheckedWarnings.UncheckedWarningLocalInspection;
import com.intellij.codeInspection.unusedImport.UnusedImportLocalInspection;
import com.intellij.openapi.projectRoots.JavaSdkVersion;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.testFramework.IdeaTestUtil;
@@ -1009,4 +1008,8 @@ public class GenericsHighlighting8Test extends LightDaemonAnalyzerTestCase {
public void testTypeParameterBoundsWithSubstitutionWhenMethodHierarchyIsChecked() throws Exception {
doTest();
}
public void testBoundsPromotionForDerivedType() throws Exception {
doTest();
}
}