intersection type flattening: prefer non raw types (IDEA-95124)

This commit is contained in:
anna
2012-11-19 17:04:40 +01:00
parent 9cef655a6a
commit ed23e353b4
3 changed files with 19 additions and 1 deletions
@@ -17,6 +17,7 @@ package com.intellij.psi;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.util.TypeConversionUtil;
import gnu.trove.THashSet;
import org.jetbrains.annotations.NotNull;
@@ -67,7 +68,7 @@ public class PsiIntersectionType extends PsiType {
PsiType type = iterator.next();
for (PsiType existing : array) {
if (type != existing && type.isAssignableFrom(existing)) {
if (type != existing && TypeConversionUtil.isAssignable(type, existing, false)) {
iterator.remove();
break;
}
@@ -0,0 +1,16 @@
interface BusinessEntity<E extends BusinessEntity<E>> {
}
interface EntityId<E extends BusinessEntity> {
E getEntity();
}
public class MyTest {
<T extends BusinessEntity<T>> T getEntity(EntityId<T> defaultValue) {
return getEntityID(defaultValue).getEntity();
}
public <P extends EntityId<?>> P getEntityID(P defaultValue) {
return null;
}
}
@@ -203,6 +203,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
public void testSpecificReturnType() throws Exception { doTest17Incompatibility(false); }
public void testParameterizedParameterBound() throws Exception { doTest17Incompatibility(false); }
public void testInstanceClassInStaticContextAccess() throws Exception { doTest17Incompatibility(false); }
public void testFlattenIntersectionType() throws Exception { doTest17Incompatibility(false); }
public void testJavaUtilCollections_NoVerify() throws Exception {
PsiClass collectionsClass = getJavaFacade().findClass("java.util.Collections", GlobalSearchScope.moduleWithLibrariesScope(getModule()));