illegal generic type for instanceof checks (IDEA-76997)

This commit is contained in:
anna
2012-04-17 12:26:40 +02:00
parent 7a17222ff6
commit ca8c474bf6
3 changed files with 35 additions and 0 deletions
@@ -0,0 +1,27 @@
class A<T> {
public void foo(Object object) {
if (object instanceof <error descr="Illegal generic type for instanceof">B</error>) {}
if (object instanceof A.B) {}
if (object instanceof A<?>.B) {}
if (object instanceof A<?>) {}
if (object instanceof <error descr="Illegal generic type for instanceof">A<String></error>) {}
if (object instanceof A) {}
if (object instanceof A[]) {}
if (object instanceof <error descr="Illegal generic type for instanceof">B[]</error>) {}
if (object instanceof A.B[]) {}
}
private class B {
}
}
class A1 {
public void foo(Object object) {
if (object instanceof B1) {}
if (object instanceof A1.B1) {}
if (object instanceof B1[]) {}
}
private class B1 {
}
}
@@ -132,6 +132,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
public void testIDEA74899() throws Exception {doTest(false);}
public void testIDEA63291() throws Exception {doTest(false);}
public void testIDEA72912() throws Exception {doTest(false);}
public void testIllegalGenericTypeInInstanceof() throws Exception {doTest(false);}
public void testJavaUtilCollections_NoVerify() throws Exception {
PsiClass collectionsClass = getJavaFacade().findClass("java.util.Collections", GlobalSearchScope.moduleWithLibrariesScope(getModule()));