Skip to content

[java] Add support for Lombok-generated getters in symbol resolution#6397

Merged
adangel merged 8 commits intopmd:mainfrom
altaiezior:issue-5787
Feb 27, 2026
Merged

[java] Add support for Lombok-generated getters in symbol resolution#6397
adangel merged 8 commits intopmd:mainfrom
altaiezior:issue-5787

Conversation

@altaiezior
Copy link

Describe the PR

Adds support for lombok generated getters in symbol resolution
PMD doesn't recognize the getters generated by lombok and results in false positives

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)
  • Added (in-code) documentation (if needed)

@altaiezior
Copy link
Author

@adangel I have created an MR to address the getter not being recognized by pmd, but I am facing some issues in reading the annotation from the field, a little help would help me complete the MR.

Copy link
Member

@adangel adangel left a comment

Choose a reason for hiding this comment

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

Thanks for your PR!

I've updated it, there is no action required on your side.

but I am facing some issues in reading the annotation from the field, a little help would help me complete the MR.

This turned out a bit tricky: In the phase, when we calling the lombok desugaring, we have not finished completely the processing of the source code. E.g. we don't have all necessary type information/symbol information in the AST, so that node.getAnnotation(...) or node.isAnnotationPresent is working.
I've restructured the code, so that we call the lombok specific analysis after the first pass of the symbol table resolution finished (and made sure, the symbol table resolver also resolves the symbols for ClassType nodes of annotations).
That way, node.getAnnotation is working.
Now the lombok specific code is separate. The downside is, that first pass of the symbol table resolution didn't know yet about the new fields/methods, so we need to redo part of the analysis.

@adangel adangel added this to the 7.22.0 milestone Feb 26, 2026
@pmd-actions-helper
Copy link
Contributor

pmd-actions-helper bot commented Feb 26, 2026

Documentation Preview

Compared to main:
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.

Regression Tester Report

(comment created at 2026-02-26 20:11:21+00:00 for 255fe59)

@adangel adangel merged commit 1dc2f91 into pmd:main Feb 27, 2026
13 checks passed
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] InvalidLogMessageFormat: False positive with lombok @Value generated methods

2 participants