mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
missed constraint on lower bound of captured wildcard (IDEA-169083)
This commit is contained in:
+7
@@ -185,6 +185,13 @@ public class StrictSubtypingConstraint implements ConstraintFormula {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (myT instanceof PsiCapturedWildcardType) {
|
||||
PsiType lowerBound = ((PsiCapturedWildcardType)myT).getLowerBound();
|
||||
if (lowerBound != PsiType.NULL) {
|
||||
constraints.add(new StrictSubtypingConstraint(lowerBound, myS));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
interface Processor<P> {
|
||||
void process(P t);
|
||||
}
|
||||
|
||||
class Test {
|
||||
void foo(Processor<? super List<String>> p) {
|
||||
p.process(Collections.emptyList());
|
||||
}
|
||||
|
||||
void bar(Processor<? extends List<String>> p) {
|
||||
p.process<error descr="'process(capture<? extends java.util.List<java.lang.String>>)' in 'Processor' cannot be applied to '(java.util.List<java.lang.Object>)'">(Collections.emptyList())</error>;
|
||||
}
|
||||
}
|
||||
+4
@@ -1005,6 +1005,10 @@ public class GenericsHighlighting8Test extends LightDaemonAnalyzerTestCase {
|
||||
doTest(true);
|
||||
}
|
||||
|
||||
public void testLowerBoundOfCapturedWildcardInSubtypingConstraint() throws Exception {
|
||||
doTest(true);
|
||||
}
|
||||
|
||||
public void testMembersContainedInCapturedWildcardType() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user