mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
SSR: find annotated method references correctly
This commit is contained in:
+2
-1
@@ -8,6 +8,7 @@ import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.search.PsiShortNamesCache;
|
||||
import com.intellij.psi.search.SearchScope;
|
||||
import com.intellij.psi.search.searches.ClassInheritorsSearch;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.structuralsearch.*;
|
||||
import com.intellij.structuralsearch.impl.matcher.CompiledPattern;
|
||||
import com.intellij.structuralsearch.impl.matcher.JavaCompiledPattern;
|
||||
@@ -211,7 +212,7 @@ public class JavaCompilingVisitor extends JavaRecursiveElementWalkingVisitor {
|
||||
}
|
||||
currentReference = (PsiReferenceExpression)qualifier;
|
||||
}
|
||||
if (!hasNoNestedSubstitutionHandlers) {
|
||||
if (!hasNoNestedSubstitutionHandlers && PsiTreeUtil.getChildOfType(reference, PsiAnnotation.class) == null) {
|
||||
createAndSetSubstitutionHandlerFromReference(
|
||||
reference,
|
||||
resolve != null ? ((PsiClass)resolve).getQualifiedName() : reference.getText(),
|
||||
|
||||
+5
-1
@@ -2938,6 +2938,7 @@ public class StructuralSearchTest extends StructuralSearchTestCase {
|
||||
" Runnable r = System.out::println;" +
|
||||
" Runnable s = this::hashCode;" +
|
||||
" Runnable t = this::new;" +
|
||||
" Runnable u = @AA A::new;" +
|
||||
" static {" +
|
||||
" System.out.println();" +
|
||||
" }" +
|
||||
@@ -2950,7 +2951,10 @@ public class StructuralSearchTest extends StructuralSearchTestCase {
|
||||
assertEquals("should find method reference 2", 2, findMatchesCount(source, pattern2));
|
||||
|
||||
String pattern3 = "'_a::'_b";
|
||||
assertEquals("should find all method references", 3, findMatchesCount(source, pattern3));
|
||||
assertEquals("should find all method references", 4, findMatchesCount(source, pattern3));
|
||||
|
||||
String pattern4 = "@AA A::new";
|
||||
assertEquals("should find annotated method references", 1, findMatchesCount(source, pattern4));
|
||||
}
|
||||
|
||||
public void testNoUnexpectedException() {
|
||||
|
||||
Reference in New Issue
Block a user