Skip to content

Commit

Permalink
fix: consider from type when filtering enclosed elements
Browse files Browse the repository at this point in the history
The enclosed element query didn't consider the type from which the
element is accessible, which made package private elements being
filtered out of the result even though they where visible for the type.
  • Loading branch information
auke- committed Feb 8, 2024
1 parent ec3b40c commit 84ba934
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ public <T extends io.micronaut.inject.ast.Element> List<T> getEnclosedElements(C
if (element.isPrivate() || element.getName().startsWith("$")) {
return false;
}
if (element instanceof MemberElement memberElement && !memberElement.isAccessible()) {
// exclude when not accessible from type
if (element instanceof MemberElement memberElement && !result.getOnlyAccessibleFromType()
.filter(fromType -> memberElement.isAccessible(fromType)).isPresent()) {
return false;
}
}
Expand Down

0 comments on commit 84ba934

Please sign in to comment.