Skip to content

Commit

Permalink
Fixed inner class behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel1464 committed Nov 29, 2024
1 parent bd71d20 commit 92cc005
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,15 @@ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment
* @return the set of all loggable types
*/
private Set<TypeElement> getLoggedTypes(RoundEnvironment roundEnv) {
// Fetches everything annotated with @Logged; classes, methods, values, etc.
var annotatedElements = roundEnv.getElementsAnnotatedWith(Logged.class);
return Stream.concat(
// 1. All type elements (classes, interfaces, or enums) with the @Logged annotation
roundEnv.getRootElements().stream()
annotatedElements.stream()
.filter(e -> e instanceof TypeElement)
.map(e -> (TypeElement) e)
.filter(t -> t.getAnnotation(Logged.class) != null),
.map(e -> (TypeElement) e),
// 2. All type elements containing a field or method with the @Logged annotation
roundEnv.getElementsAnnotatedWith(Logged.class).stream()
annotatedElements.stream()
.filter(e -> e instanceof VariableElement || e instanceof ExecutableElement)
.map(e -> e.getEnclosingElement())
.filter(e -> e instanceof TypeElement)
Expand Down

0 comments on commit 92cc005

Please sign in to comment.