mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 03:21:12 +07:00
method hierarchy with generics methods: fix adapting substitutor (IDEA-165969)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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> {}
|
||||
@@ -123,6 +123,10 @@ public class Interface8MethodsHighlightingTest extends LightCodeInsightFixtureTe
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testMethodHierarchyWithDeclaredTypeParameters() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(false, false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user