Skip to content

Commit

Permalink
Merge pull request #177 from nicky9door/ignore-nonpublic-members
Browse files Browse the repository at this point in the history
Ignore non public members for base java classes
  • Loading branch information
EugenCepoi authored Jan 25, 2022
2 parents a5e785b + c60bf15 commit e00ef31
Showing 1 changed file with 16 additions and 1 deletion.
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

0 comments on commit e00ef31

Please sign in to comment.