mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
least upper bound for primitive arrays fixed (IDEA-111420)
This commit is contained in:
@@ -70,8 +70,18 @@ public class GenericsUtil {
|
||||
}
|
||||
|
||||
if (type1 instanceof PsiArrayType && type2 instanceof PsiArrayType) {
|
||||
final PsiType componentType = getLeastUpperBound(((PsiArrayType)type1).getComponentType(),
|
||||
((PsiArrayType)type2).getComponentType(), compared, manager);
|
||||
final PsiType componentType1 = ((PsiArrayType)type1).getComponentType();
|
||||
final PsiType componentType2 = ((PsiArrayType)type2).getComponentType();
|
||||
final PsiType componentType = getLeastUpperBound(componentType1, componentType2, compared, manager);
|
||||
if (componentType1 instanceof PsiPrimitiveType &&
|
||||
componentType2 instanceof PsiPrimitiveType &&
|
||||
componentType.equalsToText(CommonClassNames.JAVA_LANG_OBJECT)) {
|
||||
final PsiElementFactory factory = JavaPsiFacade.getInstance(manager.getProject()).getElementFactory();
|
||||
final GlobalSearchScope resolveScope = GlobalSearchScope.allScope(manager.getProject());
|
||||
final PsiClassType cloneable = factory.createTypeByFQClassName(CommonClassNames.JAVA_LANG_CLONEABLE, resolveScope);
|
||||
final PsiClassType serializable = factory.createTypeByFQClassName(CommonClassNames.JAVA_IO_SERIALIZABLE, resolveScope);
|
||||
return PsiIntersectionType.createIntersection(componentType, cloneable, serializable);
|
||||
}
|
||||
return componentType.createArrayType();
|
||||
}
|
||||
if (type1 instanceof PsiIntersectionType) {
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
import java.util.List;
|
||||
|
||||
public class Test {
|
||||
private static final List<Class<?>> PRIMITIVE_ARRAY_TYPES = asList(byte[].class, int[].class);
|
||||
private static final List<?> PRIMITIVE_ARRAY_TYPES1 = asList(byte[].class, int[].class);
|
||||
|
||||
public static <T> List<T> asList(T... a) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+1
@@ -178,4 +178,5 @@ public class LightAdvHighlightingJdk7Test extends LightDaemonAnalyzerTestCase {
|
||||
public void testIDEA63731() { doTest(false, false); }
|
||||
public void testIDEA62056() { doTest(false, false); }
|
||||
public void testIDEA78916() { doTest(false, false); }
|
||||
public void testIDEA111420() { doTest(false, false); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user