Skip to content

Commit

Permalink
refactor(processor): Use actual type instead of string compare
Browse files Browse the repository at this point in the history
  • Loading branch information
LeStegii committed Feb 27, 2024
1 parent 10d4f0f commit 28d6c13
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment

private void checkResources(Element element) {
final String elementType = element.asType().toString();
if (!"java.util.ResourceBundle".equals(elementType)) {
if (!processingEnv.getTypeUtils().isSubtype(element.asType(), processingEnv.getElementUtils().getTypeElement("java.util.ResourceBundle").asType())) {
processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, error(2004).formatted(element.getSimpleName(), element.getEnclosingElement().getSimpleName()), element);
}
}

private void checkTitle(Element element) {
if (!isComponent(element.asType()) && !isController(element.asType())) {
processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "The @Title annotation can only be used on classes annotated with @Component or @Controller.", element);
processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, error(1009), element);
}
}

Expand Down

0 comments on commit 28d6c13

Please sign in to comment.