mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
SSR: cleanup annotation matching
This commit is contained in:
+12
-11
@@ -306,10 +306,7 @@ public class JavaMatchingVisitor extends JavaElementVisitor {
|
||||
|
||||
@Override
|
||||
public void visitNameValuePair(PsiNameValuePair pair) {
|
||||
final PsiIdentifier nameIdentifier = pair.getNameIdentifier();
|
||||
|
||||
final PsiNameValuePair elementNameValuePair = (PsiNameValuePair)myMatchingVisitor.getElement();
|
||||
final PsiIdentifier otherIdentifier = elementNameValuePair.getNameIdentifier();
|
||||
|
||||
final PsiAnnotationMemberValue annotationInitializer = pair.getValue();
|
||||
if (annotationInitializer != null) {
|
||||
@@ -323,16 +320,20 @@ public class JavaMatchingVisitor extends JavaElementVisitor {
|
||||
));
|
||||
}
|
||||
if (myMatchingVisitor.getResult()) {
|
||||
final MatchingHandler handler = myMatchingVisitor.getMatchContext().getPattern().getHandler(nameIdentifier);
|
||||
|
||||
if (handler instanceof SubstitutionHandler) {
|
||||
myMatchingVisitor.setResult(((SubstitutionHandler)handler).handle(otherIdentifier, myMatchingVisitor.getMatchContext()));
|
||||
}
|
||||
else if (nameIdentifier != null) {
|
||||
myMatchingVisitor.setResult(myMatchingVisitor.match(nameIdentifier, otherIdentifier));
|
||||
final PsiIdentifier nameIdentifier = pair.getNameIdentifier();
|
||||
final PsiIdentifier otherIdentifier = elementNameValuePair.getNameIdentifier();
|
||||
if (nameIdentifier == null) {
|
||||
myMatchingVisitor.setResult(otherIdentifier == null ||
|
||||
otherIdentifier.getText().equals(PsiAnnotation.DEFAULT_REFERENCED_METHOD_NAME));
|
||||
}
|
||||
else {
|
||||
myMatchingVisitor.setResult(otherIdentifier == null || otherIdentifier.getText().equals("value"));
|
||||
final MatchingHandler handler = myMatchingVisitor.getMatchContext().getPattern().getHandler(nameIdentifier);
|
||||
if (handler instanceof SubstitutionHandler) {
|
||||
myMatchingVisitor.setResult(((SubstitutionHandler)handler).handle(otherIdentifier, myMatchingVisitor.getMatchContext()));
|
||||
}
|
||||
else {
|
||||
myMatchingVisitor.setResult(myMatchingVisitor.match(nameIdentifier, otherIdentifier));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user