mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-06 10:07:41 +07:00
IDEA-130071 (SSR incorrectly says pattern does not match anything in selected scope)
This commit is contained in:
+25
-1
@@ -436,7 +436,31 @@ public class JavaCompilingVisitor extends JavaRecursiveElementWalkingVisitor {
|
||||
|
||||
|
||||
private void handleReference(PsiJavaCodeReferenceElement reference) {
|
||||
handleReferenceText(reference.getReferenceName(), myCompilingVisitor.getContext());
|
||||
if (shouldOccur(reference)) {
|
||||
handleReferenceText(reference.getReferenceName(), myCompilingVisitor.getContext());
|
||||
}
|
||||
}
|
||||
|
||||
private boolean shouldOccur(PsiJavaCodeReferenceElement reference) {
|
||||
final CompileContext compileContext = myCompilingVisitor.getContext();
|
||||
final PsiElement parent = reference.getParent();
|
||||
if (!(parent instanceof PsiReferenceList)) {
|
||||
return true;
|
||||
}
|
||||
final PsiElement grandParent = parent.getParent();
|
||||
if (!(grandParent instanceof PsiMethod)) {
|
||||
return true;
|
||||
}
|
||||
final PsiMethod method = (PsiMethod)grandParent;
|
||||
if (method.getThrowsList() != parent) {
|
||||
return true;
|
||||
}
|
||||
final String name = method.getName();
|
||||
if (!compileContext.getPattern().isTypedVar(name)) {
|
||||
return true;
|
||||
}
|
||||
final SubstitutionHandler handler = (SubstitutionHandler)compileContext.getPattern().getHandler(name);
|
||||
return !(handler != null && handler.getMinOccurs() == 0);
|
||||
}
|
||||
|
||||
private static void handleReferenceText(String refname, CompileContext compileContext) {
|
||||
|
||||
Reference in New Issue
Block a user