treat Object[] (IDEA-99061)

This commit is contained in:
anna
2013-01-15 12:49:02 +01:00
parent 4b8fc07bc7
commit 225296c67f
3 changed files with 13 additions and 1 deletions
@@ -546,7 +546,7 @@ public class PsiResolveHelperImpl implements PsiResolveHelper {
if (arg == null ||
arg.getDeepComponentType() instanceof PsiPrimitiveType ||
arg instanceof PsiIntersectionType ||
(psiClass != null && (isContraVariantPosition || !CommonClassNames.JAVA_LANG_OBJECT.equals(psiClass.getQualifiedName())))) {
(psiClass != null && (isContraVariantPosition || !CommonClassNames.JAVA_LANG_OBJECT.equals(psiClass.getQualifiedName()) || (arg instanceof PsiArrayType)))) {
PsiType bound = intersectAllExtends(typeParam, arg);
return new Pair<PsiType, ConstraintType>(bound, ConstraintType.SUPERTYPE);
}
@@ -0,0 +1,11 @@
class Test {
{
String a = cast("str");
Integer[] b = cast(new Integer[0]);
Object[] c = cast(new Object[0]);
}
private <T> T cast(Object obj) {
return (T)obj;
}
}
@@ -201,6 +201,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
public void testIDEA67597() { doTest5(false); }
public void testIDEA57539() { doTest5(false); }
public void testIDEA67570() { doTest5(false); }
public void testIDEA99061() { doTest5(false); }
public void testJavaUtilCollections_NoVerify() throws Exception {
PsiClass collectionsClass = getJavaFacade().findClass("java.util.Collections", GlobalSearchScope.moduleWithLibrariesScope(getModule()));