Skip to content

[java] Fix #6627: UnusedPrivateMethod: add javax to ignored annotations - #6821

Merged
adangel merged 2 commits into
pmd:mainfrom
UncleOwen:issue-6627-UnusedPrivateMethod-add-javax-to-ignoredAnnotations
Jun 29, 2026
Merged

adangel merged 2 commits into
pmd:mainfrom
UncleOwen:issue-6627-UnusedPrivateMethod-add-javax-to-ignoredAnnotations

Conversation

@UncleOwen

Copy link
Copy Markdown
Member

Describe the PR

Add javax.annotations.PostConstruct and javax.annotations.PreDestroy to the default list of annotations in UnusedPrivateMethodRule that cause a method to be ignored. The list already contains their newer versions in jakarta.annotations, there is no reason not to include the older version.

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)

…tSuppressionAnnotations

The new versions from jakarta are already in there, there's no reason
the old versions shouldn't be there as well.
@UncleOwen UncleOwen changed the title [java] Fix #6627: UnusedPrivateMethod add javax to ignored annotations [java] Fix #6627: UnusedPrivateMethod: add javax to ignored annotations Jun 24, 2026
@pmd-actions-helper

Copy link
Copy Markdown
Contributor

Documentation Preview

Compared to main:
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 6 violations, 15 errors and 9 configuration errors.
There are 0 changed duplications, 0 new duplications and 0 removed duplications.
There are 0 changed CPD errors, 0 new CPD errors and 0 removed CPD errors.

Regression Tester Report

(comment created at 2026-06-24 14:33:26+00:00 for cba831e)

@lukasgraef lukasgraef left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Absolutely makes sense to also add the javax variants.

@adangel adangel added this to the 7.26.0 milestone Jun 29, 2026
@adangel
adangel merged commit 07bab85 into pmd:main Jun 29, 2026
13 checks passed
@UncleOwen
UncleOwen deleted the issue-6627-UnusedPrivateMethod-add-javax-to-ignoredAnnotations branch June 29, 2026 08:38
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] UnusedPrivateMethod: could not handle javax.annotation

3 participants