EA-41372 - AIOOBE: JavaMethodsConflictResolver.isMoreSpecific

(cherry picked from commit 6f6a46ec1e26294e4a478fc6dee158123ccba406)
This commit is contained in:
anna
2012-11-29 11:53:02 +01:00
parent 135a4dec53
commit e5a6ce555d
3 changed files with 18 additions and 2 deletions
@@ -456,8 +456,8 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{
PsiType[] types1 = new PsiType[max];
PsiType[] types2 = new PsiType[max];
for (int i = 0; i < max; i++) {
PsiType type1 = params1[Math.min(i, params1.length - 1)].getType();
PsiType type2 = params2[Math.min(i, params2.length - 1)].getType();
PsiType type1 = params1.length > 0 ? params1[Math.min(i, params1.length - 1)].getType() : null;
PsiType type2 = params2.length > 0 ? params2[Math.min(i, params2.length - 1)].getType() : null;
if (applicabilityLevel == MethodCandidateInfo.ApplicabilityLevel.VARARGS) {
if (type1 instanceof PsiEllipsisType && type2 instanceof PsiEllipsisType &&
(!JavaVersionService.getInstance().isAtLeast(class1, JavaSdkVersion.JDK_1_7) || ((PsiArrayType)type1).getComponentType().equalsToText(CommonClassNames.JAVA_LANG_OBJECT) || ((PsiArrayType)type2).getComponentType().equalsToText(CommonClassNames.JAVA_LANG_OBJECT))) {
@@ -0,0 +1,12 @@
interface Func<TIn, TOut>{
TOut run(TIn in);
}
class Main {
public static void main(final String[] args) {
Func<Integer, String> func = Integer::toString;
System.out.println(func.run(6));
}
}
@@ -145,6 +145,10 @@ public class MethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
doTest(true);
}
public void testResolveConflicts() throws Exception {
doTest(true);
}
private void doTest() throws Exception {
doTest(false);
}