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

Ignore non public members for base java classes #177

Merged
merged 3 commits into from
Jan 25, 2022
Merged
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 @@ -70,7 +70,22 @@ public VisibilityFilter(int... modifier) {
* @return true if this member is visible according to this filter.
*/
public final boolean isVisible(Member member) {
return isVisible(member.getModifiers());
boolean visible = isVisible(member.getModifiers());

//Due to recent changes involving reflection access to base java classes,
//we need to perform an additional check to ensure that members belonging
//to java/javax packages are public. Non-public members will always be considered not visible
if(visible){
Class<?> clazz = member.getDeclaringClass();
String className = clazz.getName();
if(className.startsWith("java.") || className.startsWith("javax.")){
if(!Modifier.isPublic(member.getModifiers())){
visible = false;
}
}
}

return visible;
}

public final boolean isVisible(int modifiers) {
Expand Down