Skip to content

[java] Fix #6459: special case main in PublicMemberInNonPublicType - #6804

Merged
adangel merged 3 commits into
pmd:mainfrom
UncleOwen:issue-6459-special-case-main
Jun 23, 2026
Merged

adangel merged 3 commits into
pmd:mainfrom
UncleOwen:issue-6459-special-case-main

Conversation

@UncleOwen

Copy link
Copy Markdown
Member

Describe the PR

This PR removes the violation for main().

For simplicity, I didn't add version logic. Strictly speaking, this should be a violation in Java >= 25. But main() is special in any case, so I can see why people would want to keep main public, even in Java >= 25.

Related issues

Ready?

  • Added unit tests for fixed bug/feature
  • Passing all unit tests
  • Complete build ./mvnw clean verify passes (checked automatically by github actions)
  • [n/a] Added (in-code) documentation (if needed)

@pmd-actions-helper

pmd-actions-helper Bot commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

Documentation Preview

No relevant source code has been changed, pmdtester skipped.

(comment created at 2026-06-23 08:43:42+00:00 for 674a584)

@adangel adangel added this to the 7.26.0 milestone Jun 23, 2026
@adangel
adangel merged commit 6c60e42 into pmd:main Jun 23, 2026
2 checks passed
@UncleOwen
UncleOwen deleted the issue-6459-special-case-main branch June 23, 2026 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[java] PublicMemberInNonPublicType: False positive for main(...) methods

2 participants