You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[java] PublicMemberInNonPublicType: False negative for overridden methods #6460
The new rule does not flag methods, when they are overridden in sub classes with the wrong visibility.
Code Sample demonstrating the issue:
classOuter {
publicvoiddetected() {
// this method is correctly detected
}
voidnotDetected() {
// this method is correctly not detected here because it is package private
}
staticclassNestedextendsOuter {
publicvoidnestedMethod() {
// this method is correctly detected
}
@OverridepublicvoidnotDetected() {
// this one should be detected now, but is not
}
}
}
Expected outcome:
PMD should report 3 violations, but does report only 2.
[WARNING] PMD Failure: edu.hm.hafner.grading.Outer:4 Rule:PublicMemberInNonPublicType Priority:3 Public member 'detected' declared in a non-public type.
[WARNING] PMD Failure: edu.hm.hafner.grading.Outer.Nested:13 Rule:PublicMemberInNonPublicType Priority:3 Public member 'nestedMethod' declared in a non-public type.
changed the title [-]`PublicMemberInNonPublicType` does not detect overridden methods[/-][+][java] PublicMemberInNonPublicType: False negative for overridden methods[/+]on Feb 16, 2026
Activity
[-]`PublicMemberInNonPublicType` does not detect overridden methods[/-][+][java] PublicMemberInNonPublicType: False negative for overridden methods[/+]Fix pmd#6460
[doc] Update release notes (pmd#6460)
Fix pmd#6460
[doc] Update release notes (pmd#6460)
[java] Fix #6460: Fix false negative for overridden methods in Public…