Is there a way in IntelliJ IDEA to set a breakpoint in a setter method that is generated by Lombok?
This would be very useful in certain debugging scenarios, e.g. to see when the setter is called from a framework like Hibernate.
In fact, the generated setter methods are displayed in the structure view of IntelliJ IDEA (Lombok plugin in use). But I've not found a way to set a breakpoint via the context menu or such.
Manage breakpoints To do this, go to Settings/Preferences | Build, Execution, Deployment | Debugger and select Drag to the editor or click with middle mouse button. Clicking a breakpoint will then enable or disable it.
Press F3 and then press F9 to add a breakpoint. This adds a breakpoint to the first method found using the trick.
Run the program in debug modeClick the Run icon in the gutter, then select Modify Run Configuration. Enter arguments in the Program arguments field. Click the Run button near the main method. From the menu, select Debug.
As a workaround you may use Java Field Watchpoint. In such a case every access/modification of the field will result in a break point.
The disadvantage of this approach is getting a thread suspension both when you access/modify the field directly or using getter/setter methods.
However, when you catch a breakpoint using setter methods, IDEA also shows a parameter (with the same name as the field used for the watch point) in Variables window and the breakpoint is shown not in the field's line, but in the class' line.
The following short description, how to create a field watch point, was copied from https://www.jetbrains.com/idea/help/creating-field-watchpoints.html:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With