How can I debug my changes on lombok ?

152 views
Skip to first unread message

Luck

unread,
Oct 26, 2023, 4:58:02 PM10/26/23
to Project Lombok
Hi guys, I´m learning about Lombok code and I don´t know how can I debug this.
There are somebody to help-me with this ?

guillaume LE LOUËT

unread,
Oct 28, 2023, 6:02:40 AM10/28/23
to Project Lombok
Do you have a public git fork ?

Luck

unread,
Oct 31, 2023, 3:00:37 PM10/31/23
to Project Lombok

Luck

unread,
Oct 31, 2023, 3:00:45 PM10/31/23
to Project Lombok
Yes, but I dont, know how can I debug a processor.

Em sábado, 28 de outubro de 2023 às 07:02:40 UTC-3, guillaume LE LOUËT escreveu:

Reinier Zwitserloot

unread,
Nov 16, 2023, 2:37:09 AM11/16/23
to Project Lombok
Debugging processors is very difficult  because they really wanna be jars. Our ant buildscript can generate an eclipse debug target that does it, but, it's complicated. Fortunately, lombok builds quickly. If you're not all that experienced in classloaders and hot code replace, maybe just debug by way of sysout statements and building it a lot.

Luck

unread,
Dec 1, 2023, 4:56:54 AM12/1/23
to Project Lombok
I try with sysout, but it´s doesnt work. :(

Zoltán Csorba

unread,
Jun 23, 2024, 4:53:55 AM (6 days ago) Jun 23
to Project Lombok
I know it's a late answer, but it still might be helpful for anyone working on a custom lombok implementation.
Debugging a processor can be done fairly easily with Eclipse. You need to create a new plugin project in your Eclipse IDE where you're working on the lombok project. It doesn't need to be a "real" plugin with any functionality at all, just a standard plugin project generated by Eclipse. Then run that plugin project as an Eclipse application (Run as/Eclipse Application, or press Alt+Shift+X/E). Then edit the run configuration and add your lombok distribution as a java agent to the VM arguments. E.g. -javaagent:${project_loc:lombok}/dist/lombok.jar
Then you can use the "Debug as/Eclipse Application" and done. You have an eclipse application that you can debug. You just need to create or import a Java project with some sources that use the annotation that you want to debug, set your breakpoints in your own lombok project and you can debug the process flow.

The only inconvenience is that you need to call the "ant dist" each time before you start up the eclipse in debug mode. But after that you can do small modifications in the source code (e.g. updating a method body) that is going to be updated by the eclipse debugger with hot code replacement. And it will tell you when you need to restart the application when a change cannot be updated, e.g. a method was renamed or new parameter was added, etc.
I haven't tried JRebel or HotSwapAgent with this yet, but I assume that they would work even better, with fewer restarts.

But this approach is better than just using sysout.
Reply all
Reply to author
Forward
0 new messages