mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
inherit with different parameterization: fix for raw types (IDEA-186271)
This commit is contained in:
+3
-1
@@ -354,7 +354,9 @@ public class GenericsHighlightUtil {
|
||||
final PsiClass superClass = result.getElement();
|
||||
if (superClass == null || visited.contains(superClass)) continue;
|
||||
PsiSubstitutor superTypeSubstitutor = result.getSubstitutor();
|
||||
superTypeSubstitutor = MethodSignatureUtil.combineSubstitutors(superTypeSubstitutor, derivedSubstitutor);
|
||||
//JLS 4.8 The superclasses (respectively, superinterfaces) of a raw type are the erasures of the superclasses (superinterfaces) of any of the parameterizations of the generic type.
|
||||
superTypeSubstitutor = PsiUtil.isRawSubstitutor(aClass, derivedSubstitutor) ? JavaPsiFacade.getElementFactory(aClass.getProject()).createRawSubstitutor(superClass)
|
||||
: MethodSignatureUtil.combineSubstitutors(superTypeSubstitutor, derivedSubstitutor);
|
||||
|
||||
final PsiSubstitutor inheritedSubstitutor = inheritedClasses.get(superClass);
|
||||
if (inheritedSubstitutor != null) {
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
|
||||
interface A<T> {}
|
||||
|
||||
interface X1<T> extends A<String> {}
|
||||
interface Y1<T> extends A<Integer> {}
|
||||
interface Z1 extends X1, Y1 { }
|
||||
|
||||
interface X2 extends A<String> {}
|
||||
interface Y2<T> extends A<Integer> {}
|
||||
<error descr="'A' cannot be inherited with different type arguments: 'java.lang.String' and 'null'">interface Z2 extends X2, Y2</error> { }
|
||||
|
||||
interface X3 extends A<String> {}
|
||||
interface Y3 extends A<Integer> {}
|
||||
<error descr="'A' cannot be inherited with different type arguments: 'java.lang.String' and 'java.lang.Integer'">interface Z3 extends X3, Y3</error> { }
|
||||
+1
@@ -430,4 +430,5 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testRecursiveParamBoundsWhenSuperSubstitution() { doTest6(false); }
|
||||
public void testCaptureForBoundCheck() { doTest6(false); }
|
||||
public void testGetClassInAnonymous() { doTest6(false); }
|
||||
public void testInheritFromDifferentParameterizations() { doTest6(false); }
|
||||
}
|
||||
Reference in New Issue
Block a user