moreSpecific conflicts resolve (IDEA-111085)

This commit is contained in:
anna
2013-07-26 16:53:43 +02:00
parent b31f5f8ced
commit b55834ea6e
3 changed files with 23 additions and 0 deletions

View File

@@ -626,6 +626,8 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{
}
private static Specifics chooseHigherDimension(PsiType type1, PsiType type2) {
if (type1 != null && type1.equalsToText(CommonClassNames.JAVA_LANG_OBJECT)) return null;
if (type2 != null && type2.equalsToText(CommonClassNames.JAVA_LANG_OBJECT)) return null;
int d1 = type1 != null ? type1.getArrayDimensions() : 0;
int d2 = type2 != null ? type2.getArrayDimensions() : 0;
if (d1 > d2) {

View File

@@ -0,0 +1,20 @@
import java.io.*;
import java.util.List;
class Main {
public <T> T foo(String str, Class<T> classOfT) {
return null;
}
public <T> T foo(String str, Serializable typeOfT) {
return null;
}
{
asList(foo("", String[].class));
}
public static <T> List<T> asList(T... a) {
return null;
}
}

View File

@@ -305,6 +305,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
public void testIDEA110947() { doTest5(false); }
public void testNoInferenceFromTypeCast() { doTest5(false); }
public void testCaptureWildcardsInTypeCasts() { doTest5(false); }
public void testIDEA111085() { doTest5(false); }
public void testJavaUtilCollections_NoVerify() throws Exception {
PsiClass collectionsClass = getJavaFacade().findClass("java.util.Collections", GlobalSearchScope.moduleWithLibrariesScope(getModule()));