make capture<? super Object> == Object

This commit is contained in:
Anna Kozlova
2015-03-23 19:25:33 +01:00
parent d39e16825e
commit 5ed4840dad
3 changed files with 18 additions and 1 deletions

View File

@@ -82,7 +82,11 @@ public abstract class PsiClassType extends PsiType {
public boolean equals(Object obj) {
if (this == obj) return true;
if (!(obj instanceof PsiClassType)) return false;
if (!(obj instanceof PsiClassType)) {
return obj instanceof PsiCapturedWildcardType &&
((PsiCapturedWildcardType)obj).getLowerBound().equalsToText(CommonClassNames.JAVA_LANG_OBJECT) &&
equalsToText(CommonClassNames.JAVA_LANG_OBJECT);
}
PsiClassType otherClassType = (PsiClassType)obj;
String className = getClassName();

View File

@@ -0,0 +1,9 @@
class A<T> {}
class Test {
{
A<? super Object> queue = null;
A<Object> q = queue;
queue = q;
}
}

View File

@@ -471,6 +471,10 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false);
}
public void testSuperObjectCapturedWildcardEquality() throws Exception {
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()));
assertNotNull(collectionsClass);