method hierarchy with generics methods: fix adapting substitutor (IDEA-165969)

This commit is contained in:
Anna.Kozlova
2016-12-28 13:23:36 +01:00
parent 0e2a160436
commit f6364fbc68
3 changed files with 27 additions and 1 deletions

View File

@@ -411,7 +411,7 @@ public class MethodSignatureUtil {
if (r1 instanceof PsiClassType && r2 != null) {
//R1, adapted to the type parameters of d2 (§8.4.4), is a subtype of R2.
final PsiSubstitutor adaptingSubstitutor = getSuperMethodSignatureSubstitutor(d1, d2);
final PsiSubstitutor adaptingSubstitutor = getSuperMethodSignatureSubstitutor(d2, d1);
if (adaptingSubstitutor != null && r2.isAssignableFrom(adaptingSubstitutor.substitute(r1))) {
return true;
}

View File

@@ -0,0 +1,22 @@
interface C<E> {}
interface L<E> extends C<E> {
<T> L<T> foo();
}
interface L1<E> extends L<E>, C1<E> {
@Override
default <K> L<K> foo() {
return null;
}
}
interface C1<E> extends C<E> {
default <M> C<M> foo() {
return null;
}
}
interface C2<E> extends C1<E> {}
interface L2<E> extends C2<E>, L1<E>, L<E> {}

View File

@@ -123,6 +123,10 @@ public class Interface8MethodsHighlightingTest extends LightCodeInsightFixtureTe
doTest();
}
public void testMethodHierarchyWithDeclaredTypeParameters() throws Exception {
doTest();
}
private void doTest() {
doTest(false, false);
}