mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
most specific: do not start java 8 algorithm for provided type args (IDEA-125855)
This commit is contained in:
+4
-1
@@ -696,7 +696,10 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{
|
||||
PsiMethod method2,
|
||||
PsiSubstitutor siteSubstitutor1) {
|
||||
if (languageLevel.isAtLeast(LanguageLevel.JDK_1_8) && method2 != null && method1.getTypeParameters().length > 0 && myArgumentsList instanceof PsiExpressionList) {
|
||||
return InferenceSession.isMoreSpecific(method2, method1, siteSubstitutor1, ((PsiExpressionList)myArgumentsList).getExpressions(), myArgumentsList, varargsPosition);
|
||||
final PsiElement parent = myArgumentsList.getParent();
|
||||
if (parent instanceof PsiCallExpression && ((PsiCallExpression)parent).getTypeArguments().length == 0) {
|
||||
return InferenceSession.isMoreSpecific(method2, method1, siteSubstitutor1, ((PsiExpressionList)myArgumentsList).getExpressions(), myArgumentsList, varargsPosition);
|
||||
}
|
||||
}
|
||||
final int applicabilityLevel = PsiUtil.getApplicabilityLevel(method1, methodSubstitutor1, types2AtSite, languageLevel, false, varargsPosition);
|
||||
return applicabilityLevel > MethodCandidateInfo.ApplicabilityLevel.NOT_APPLICABLE;
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
class Test {
|
||||
|
||||
private static <E> void <warning descr="Private method 'x(java.util.Collection<E>)' is never used">x</warning>(Collection<E> collection) {
|
||||
System.out.println(collection);
|
||||
}
|
||||
|
||||
private static <E> void x(List<E> list) {
|
||||
System.out.println(list);
|
||||
}
|
||||
|
||||
public static void main(List list) {
|
||||
Test.<Object[]>x(list);
|
||||
}
|
||||
}
|
||||
+4
@@ -107,6 +107,10 @@ public class MostSpecificResolutionTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
public void testIDEA125855() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user