Skip to content

Commit

Permalink
Add annotation reference to index
Browse files Browse the repository at this point in the history
  • Loading branch information
mickaelistria authored and robstryker committed Jan 31, 2025
1 parent 808a091 commit 653256c
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
import org.eclipse.jdt.core.dom.*;
import org.eclipse.jdt.internal.core.search.matching.MethodPattern;

/**
* Visits an AST to feed the index. Similar to {@link SourceIndexerRequestor} but using
* DOM instead of ECJ parser.
*/
class DOMToIndexVisitor extends ASTVisitor {

private SourceIndexer sourceIndexer;
Expand Down Expand Up @@ -299,6 +303,22 @@ private char[] name(Type type) {
return type.toString().toCharArray();
}

@Override
public boolean visit(NormalAnnotation annotation) {
this.sourceIndexer.addAnnotationTypeReference(simpleName(annotation.getTypeName()));
return true;
}
@Override
public boolean visit(MarkerAnnotation annotation) {
this.sourceIndexer.addAnnotationTypeReference(simpleName(annotation.getTypeName()));
return true;
}
@Override
public boolean visit(SingleMemberAnnotation annotation) {
this.sourceIndexer.addAnnotationTypeReference(simpleName(annotation.getTypeName()));
return true;
}

@Override
public boolean visit(SimpleType type) {
this.sourceIndexer.addTypeReference(name(type));
Expand Down

0 comments on commit 653256c

Please sign in to comment.