calls on raw type: need erasure

This commit is contained in:
anna
2013-03-01 20:05:19 +01:00
parent fcd09e4b99
commit 140a30285d
3 changed files with 29 additions and 1 deletions
@@ -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();
@@ -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);