non wildcard parameterization: workaround problems caused by different parameterizations of the same class during glb algorithm (IDEA-132690)

This commit is contained in:
Anna Kozlova
2015-09-01 16:30:50 +03:00
parent d7f75583f9
commit 21e2fd41c0
3 changed files with 19 additions and 1 deletions
@@ -185,7 +185,7 @@ public class FunctionalInterfaceParameterizationUtil {
newParameters[i] = bound != null ? bound : PsiType.getJavaLangObject(psiClass.getManager(), psiClassType.getResolveScope());
for (PsiClassType paramBound : typeParameters[i].getExtendsListTypes()) {
if (!PsiPolyExpressionUtil.mentionsTypeParameters(paramBound, typeParametersSet)) {
newParameters[i] = GenericsUtil.getGreatestLowerBound(paramBound, newParameters[i]);
newParameters[i] = GenericsUtil.getGreatestLowerBound(newParameters[i], paramBound);
}
}
}
@@ -0,0 +1,13 @@
interface A<T> {
void method(B<? extends A<? super T>> arg);
}
interface B<T extends A<?>> {
void method();
}
class Test {
public static void test(A<?> a) {
a.method(() -> {});
}
}
@@ -207,6 +207,11 @@ public class NewLambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
doTest();
}
//JDK-8043374
public void testIntersectionTypeOfDifferentParameterizationOfTheSameClassInNonWildcardParameterization() throws Exception {
doTest();
}
private void doTest() {
doTest(false);
}