mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
intersection type flattening: prefer non raw types (IDEA-95124)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
+16
@@ -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()));
|
||||
|
||||
Reference in New Issue
Block a user