[java] Add support for Lombok-generated getters in symbol resolution#6397
[java] Add support for Lombok-generated getters in symbol resolution#6397
Conversation
|
@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. |
adangel
left a comment
There was a problem hiding this comment.
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.
pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/AstDisambiguationPass.java
Outdated
Show resolved
Hide resolved
|
Compared to main: (comment created at 2026-02-26 20:11:21+00:00 for 255fe59) |
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?
./mvnw clean verifypasses (checked automatically by github actions)