Skip to content

[java] PublicMemberInNonPublicType can only be suppressed on type and not member level #6461

Closed

Description

@adangel

BTW: In order to ignore the violation I need to suppress on the type and not on the affected method, it would be nice if that can be changed as well.

Originally posted by @uhafner in #6459

Activity

  1. added
    a:bug
    on Feb 16, 2026
  2. UncleOwen commented on Jun 20, 2026

    @UncleOwen
    Member

    Cannot reproduce. This code ...

    class MyTest {
        // @SuppressWarnings("PMD.PublicMemberInNonPublicType")
        public static void main(final String... args)  {
            // main method that is invoked in IntelliJ
        }
    }

    ... does trigger a PublicMemberInNonPublicType violation in both 7.22.0 and 7.25.0. The violation goes away if I remove the // in line 2.

    @uhafner Could you please double-check?

  3. adangel commented on Jun 22, 2026

    @adangel
    MemberAuthor

    @UncleOwen In any case, I think it makes sense, to add such an example as a test case. To be sure, we can actually suppress the violation.

  4. UncleOwen commented on Jun 22, 2026

    @UncleOwen
    Member

    @adangel agreed.

  5. added
    was:unreproducible
    on Jun 23, 2026
  6. added a commit that references this issue on Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:bugwas:unreproducible

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions