distinct prover: do not distinguish raw type arguments from type arguments without params (IDEA-119546)

This commit is contained in:
Anna Kozlova
2014-01-21 18:22:40 +04:00
parent 3f6a77a6cb
commit baee0eb2b3
3 changed files with 19 additions and 3 deletions
@@ -104,9 +104,15 @@ public class TypesDistinctProver {
for (PsiTypeParameter parameter : substitutor1.getSubstitutionMap().keySet()) {
final PsiType substitutedType1 = substitutor1.substitute(parameter);
final PsiType substitutedType2 = substitutor2.substitute(parameter);
if (substitutedType1 == null && substitutedType2 == null) return false;
if (substitutedType1 == null || substitutedType2 == null) {
return true;
if (substitutedType1 == null && substitutedType2 == null){
continue;
}
if (substitutedType1 == null) {
if (type2 instanceof PsiClassType && ((PsiClassType)type2).hasParameters()) return true;
}
else if (substitutedType2 == null) {
if (type1 instanceof PsiClassType && ((PsiClassType)type1).hasParameters()) return true;
} else {
if (provablyDistinct(substitutedType1, substitutedType2, level + 1)) return true;
if (substitutedType1 instanceof PsiWildcardType && !((PsiWildcardType)substitutedType1).isBounded()) return true;
@@ -0,0 +1,9 @@
public interface I<K> {
}
abstract class SpringHighlightingTestCase<T extends I>{
@SuppressWarnings("unchecked")
protected Class<T> getBuilderClass() {
return (Class<T>)I.class;
}
}
@@ -334,6 +334,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
public void testIDEA116493() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
public void testIDEA117827() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
public void testIDEA118037() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
public void testIDEA119546() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
public void testJavaUtilCollections_NoVerify() throws Exception {
PsiClass collectionsClass = getJavaFacade().findClass("java.util.Collections", GlobalSearchScope.moduleWithLibrariesScope(getModule()));