mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
subtyping constraint: apply capture conversion for captured wildcard bound according to the direct supertype of parameterized type specification
This commit is contained in:
@@ -94,6 +94,9 @@ public class JavaClassSupersImpl extends JavaClassSupers {
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (lowerBound instanceof PsiCapturedWildcardType) {
|
||||
return processLowerBound(((PsiCapturedWildcardType)lowerBound).getUpperBound(), derivedClass, scope, derivedSubstitutor);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -20,6 +20,7 @@ import com.intellij.psi.impl.source.resolve.graphInference.InferenceBound;
|
||||
import com.intellij.psi.impl.source.resolve.graphInference.InferenceSession;
|
||||
import com.intellij.psi.impl.source.resolve.graphInference.InferenceVariable;
|
||||
import com.intellij.psi.util.InheritanceUtil;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.psi.util.TypeConversionUtil;
|
||||
|
||||
import java.util.HashSet;
|
||||
@@ -133,7 +134,7 @@ public class StrictSubtypingConstraint implements ConstraintFormula {
|
||||
else if (myS instanceof PsiCapturedWildcardType) {
|
||||
final PsiType upperBound = ((PsiCapturedWildcardType)myS).getUpperBound();
|
||||
if (upperBound instanceof PsiClassType) {
|
||||
sType = (PsiClassType)upperBound;
|
||||
sType = (PsiClassType)PsiUtil.captureToplevelWildcards(upperBound, ((PsiCapturedWildcardType)myS).getContext());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
import java.util.List;
|
||||
|
||||
class Test {
|
||||
void f(List<? extends I<?>> list) {
|
||||
foo(list.get(0));
|
||||
}
|
||||
|
||||
private <T> T foo(I<T> id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
interface I<Z> {
|
||||
}
|
||||
}
|
||||
+4
@@ -472,6 +472,10 @@ public class GraphInferenceHighlightingTest extends LightDaemonAnalyzerTestCase
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testCapturedConversionDuringDirectSuperCheck() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user