mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 05:10:22 +07:00
accept raw subtyping when instance method is called on raw type (IDEA-107957)
This commit is contained in:
@@ -467,7 +467,7 @@ public final class PsiUtil extends PsiUtilCore {
|
||||
if (args.length < parms.length - 1) return ApplicabilityLevel.NOT_APPLICABLE;
|
||||
|
||||
final PsiClass containingClass = method.getContainingClass();
|
||||
final boolean isRaw = containingClass != null && isRawSubstitutor(containingClass, substitutorForMethod);
|
||||
final boolean isRaw = containingClass != null && isRawSubstitutor(method, substitutorForMethod) && isRawSubstitutor(containingClass, substitutorForMethod);
|
||||
if (!areFirstArgumentsApplicable(args, parms, languageLevel, substitutorForMethod, isRaw)) return ApplicabilityLevel.NOT_APPLICABLE;
|
||||
if (args.length == parms.length) {
|
||||
if (parms.length == 0) return ApplicabilityLevel.FIXED_ARITY;
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
class Test1 {
|
||||
|
||||
private static final Foo<Boolean> test = new Foo().method(Boolean.TRUE);
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(test);
|
||||
}
|
||||
|
||||
public static class Foo<T> {
|
||||
public Foo<Boolean> method(boolean arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <T extends Enum<T>> Foo<T> method(T arg) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Test2 {
|
||||
|
||||
private static final Foo<Boolean> test = Foo.method(Boolean.TRUE);
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(test);
|
||||
}
|
||||
|
||||
public static class Foo<T> {
|
||||
public static Foo<Boolean> method(boolean arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <T extends Enum<T>> Foo<T> method(T arg) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -236,6 +236,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testIDEA20244() throws Exception { doTest5(false);}
|
||||
public void testIDEA22005() throws Exception { doTest5(false);}
|
||||
public void testIDEA57259() throws Exception { doTest5(false);}
|
||||
public void testIDEA107957() throws Exception { doTest6(false);}
|
||||
public void testIDEA106964() throws Exception { doTest5(false);}
|
||||
public void testInheritedWithDifferentArgsInTypeParams() throws Exception { doTest5(false);}
|
||||
public void testIllegalForwardReferenceInTypeParameterDefinition() throws Exception { doTest5(false);}
|
||||
|
||||
Reference in New Issue
Block a user