Custom Annotation Handler & MapStruct

98 views
Skip to first unread message

Denis Kokorin

unread,
Dec 8, 2020, 5:36:12 PM12/8/20
to Project Lombok

Greetings!

I managed to implement lombok extension: https://github.com/kokorin/lombok-presence-checker

In short it adds hasProperty methods. Here is a test that checks this.

Now my goal is to leverage generated methods in MapStruct mappers. But for some reason MapStruct does see lombok's Getters & Setters but doesn't see my hasProperty methods.
In a debugger I see that HandleGetter works first, then my HandlePresenceChecker, then MapStruct. ClassSymbol passed to MapStruct  contains getters & setters, but it doesn't contain my presence checker.

I'm aware of multiple rounds of annotation processors workflow, but can't understand what is missing.

Can anyone give me an advice what to check next?

Denis Kokorin

unread,
Dec 9, 2020, 1:32:40 AM12/9/20
to Project Lombok
I solved that issue. It appeared I had to use overloaded injectMethod: lombok.javac.handlers.JavacHandlerUtil#injectMethod(lombok.javac.JavacNode, com.sun.tools.javac.tree.JCTree.JCMethodDecl, com.sun.tools.javac.util.List<com.sun.tools.javac.code.Type>, com.sun.tools.javac.code.Type)
Reply all
Reply to author
Forward
0 new messages