Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix annotations when coming from java.lang (like @Override) #113

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ public boolean matchesAnnotation(String annotation) {
// If the annotation query is happening on an annotation, the annotation field in the annotation query can be null
if (isOnAnnotation() && getType() == null) {
return true;
// Classes in the "java.lang" package are never imported, so there is a chance these annotations don't come
// as FQNs from the LS. Therefore lets check if the annotation is in "java.lang"
} else if (getType().startsWith("java.lang.") && !annotation.contains(".")) {
return Pattern.matches(getType().replace("java.lang.", ""), annotation);
} else {
return Pattern.matches(getType(), annotation);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ private String getFQN(IAnnotation annotation) {
.filter(i -> i.getElementName().endsWith(name))
.findFirst()
.map(IImportDeclaration::getElementName)
.orElse("");
.orElse(name);
}
}

Expand Down
Loading