IDEA-232566 - added an edge between annotation access expression and annotation method in the ref graph, handled the Repeatable annotation

GitOrigin-RevId: 2fd2edd464423cda801e29c9cfd9fc03af72da6c
This commit is contained in:
Ilyas Selimov
2021-02-02 00:55:49 +07:00
committed by intellij-monorepo-bot
parent 3432bd3e89
commit fb0badb4cd
10 changed files with 138 additions and 18 deletions

View File

@@ -60,6 +60,26 @@ public class RefJavaUtilImpl extends RefJavaUtil {
return false;
}
@Override
public boolean visitElement(@NotNull UElement node) {
UNamedExpression namedExpr = ObjectUtils.tryCast(node, UNamedExpression.class);
if (namedExpr == null) return false;
UAnnotation ann = ObjectUtils.tryCast(namedExpr.getUastParent(), UAnnotation.class);
if (ann == null) return false;
String annFqn = ann.getQualifiedName();
if (annFqn == null) return false;
PsiMethod annMethod = UastUtils.getAnnotationMethod(namedExpr);
if (annMethod == null) return false;
RefMethod annRefMethod = ObjectUtils.tryCast(refFrom.getRefManager().getReference(annMethod), RefMethod.class);
if (annRefMethod == null) return false;
RefJavaElementImpl annRefClass = ObjectUtils.tryCast(
annRefMethod.getRefManager().getReference(annMethod.getContainingClass()), RefJavaElementImpl.class);
if (annRefClass != null) {
annRefClass.addReference(annRefMethod, annMethod.getOriginalElement(), decl, false, true, null);
}
return false;
}
@Override
public boolean visitTypeReferenceExpression(@NotNull UTypeReferenceExpression node) {
PsiType type = node.getType();