mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
calls on raw type: need erasure
This commit is contained in:
+8
-1
@@ -17,6 +17,7 @@ package com.intellij.psi.impl.source.tree.java;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.*;
|
||||
@@ -194,7 +195,13 @@ public class PsiMethodCallExpressionImpl extends ExpressionPsiElement implements
|
||||
if (is15OrHigher) {
|
||||
final PsiSubstitutor substitutor = result.getSubstitutor();
|
||||
PsiType substitutedReturnType = substitutor.substitute(ret);
|
||||
if (PsiUtil.isRawSubstitutor(method, substitutor) && ret.equals(substitutedReturnType)) return TypeConversionUtil.erasure(ret);
|
||||
if (substitutedReturnType == null) return TypeConversionUtil.erasure(ret);
|
||||
if (PsiUtil.isRawSubstitutor(method, substitutor)) {
|
||||
final PsiType returnTypeErasure = TypeConversionUtil.erasure(ret);
|
||||
if (Comparing.equal(TypeConversionUtil.erasure(substitutedReturnType), returnTypeErasure)) {
|
||||
return returnTypeErasure;
|
||||
}
|
||||
}
|
||||
PsiType lowerBound = PsiType.NULL;
|
||||
if (substitutedReturnType instanceof PsiCapturedWildcardType) {
|
||||
lowerBound = ((PsiCapturedWildcardType)substitutedReturnType).getLowerBound();
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
class Bar {
|
||||
private List<Property> getChildren(Property property, PropertiesContainer c) {
|
||||
return property.getChildren(c);
|
||||
}
|
||||
|
||||
static class PropertiesContainer<M extends Property> {}
|
||||
|
||||
}
|
||||
|
||||
class Property<K> {
|
||||
public List<? extends Property<K>> getChildren(K container) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
@@ -213,6 +213,10 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest5(false);
|
||||
}
|
||||
|
||||
public void testMethodCallOnRawTypesExtended() throws Exception {
|
||||
doTest5(false);
|
||||
}
|
||||
|
||||
public void testJavaUtilCollections_NoVerify() throws Exception {
|
||||
PsiClass collectionsClass = getJavaFacade().findClass("java.util.Collections", GlobalSearchScope.moduleWithLibrariesScope(getModule()));
|
||||
assertNotNull(collectionsClass);
|
||||
|
||||
Reference in New Issue
Block a user