mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
good code red: do not create ? super Object constraint as nothing would match (IDEA-77991)
This commit is contained in:
+2
-1
@@ -462,10 +462,11 @@ public class PsiResolveHelperImpl implements PsiResolveHelper {
|
||||
JavaResolveResult paramResult = ((PsiClassType)param).resolveGenerics();
|
||||
PsiClass paramClass = (PsiClass)paramResult.getElement();
|
||||
if (typeParam == paramClass) {
|
||||
final PsiClass psiClass = PsiUtil.resolveClassInType(arg);
|
||||
if (arg == null ||
|
||||
arg.getDeepComponentType() instanceof PsiPrimitiveType ||
|
||||
arg instanceof PsiIntersectionType ||
|
||||
PsiUtil.resolveClassInType(arg) != null) {
|
||||
(psiClass != null && !CommonClassNames.JAVA_LANG_OBJECT.equals(psiClass.getQualifiedName()))) {
|
||||
PsiType bound = intersectAllExtends(typeParam, arg);
|
||||
return new Pair<PsiType, ConstraintType>(bound, ConstraintType.SUPERTYPE);
|
||||
}
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
class Test {
|
||||
static {
|
||||
Class<Test> testClass = get(Test.class);
|
||||
foo(testClass);
|
||||
}
|
||||
|
||||
static <E> Class<E> get(Class<? super E> value) {
|
||||
return null;
|
||||
}
|
||||
|
||||
static <E> E foo(Class<? super E> value) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -120,6 +120,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testTypeParameterBoundVisibilityJdk14() throws Exception { doTest(false);}
|
||||
|
||||
public void testUncheckedWarningsLevel6() throws Exception { doTest(true);}
|
||||
public void testIDEA77991() throws Exception { doTest(false);}
|
||||
|
||||
public void testJavaUtilCollections_NoVerify() throws Exception {
|
||||
PsiClass collectionsClass = getJavaFacade().findClass("java.util.Collections", GlobalSearchScope.moduleWithLibrariesScope(getModule()));
|
||||
|
||||
Reference in New Issue
Block a user