SSR: search for class should not find type parameters

This commit is contained in:
Bas Leijdekkers
2017-04-28 21:03:59 +02:00
parent 15dd2ecf6e
commit cfd301777d
2 changed files with 5 additions and 0 deletions
@@ -470,6 +470,7 @@ public class JavaMatchingVisitor extends JavaElementVisitor {
if (templateIsInterface != clazz2.isInterface()) return false;
if (templateIsInterface && clazz.isAnnotationType() && !clazz2.isAnnotationType()) return false;
if (clazz.isEnum() && !clazz2.isEnum()) return false;
if (clazz instanceof PsiTypeParameter != clazz2 instanceof PsiTypeParameter) return false;
if (!matchInAnyOrder(clazz.getExtendsList(), clazz2.getExtendsList())) {
return false;
@@ -714,6 +714,10 @@ public class StructuralSearchTest extends StructuralSearchTestCase {
"class B { { a = 10; } }\n" +
"class C { { a = 10; } }";
assertEquals("static block search", 1, findMatchesCount(s141, "class '_ { static { a = 10; } } "));
final String in = "class D<T> {}\n" +
"class T {}";
assertEquals("search for class should not find type parameters", 1, findMatchesCount(in, "class T {}"));
}
public void testParameterlessConstructorSearch() {