Skip to content

Commit

Permalink
Fix annotations when coming from java.lang (like @OverRide)
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Manuel Leflet Estrada <[email protected]>
  • Loading branch information
jmle committed Dec 10, 2024
1 parent d6ca37c commit 24adea1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
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

0 comments on commit 24adea1

Please sign in to comment.