Groovy field watchpoints new / old values in condition
Answered
In the condition for a Groovy field watchpoint, how can I get the new value and/or the old value?
I assume the value of the field will be the old value, but, since there is no explicit setter, the code doesn't explicitly include a method parameter name for the new value.
Maybe Groovy creates a method parameter with a specific name, but I don't use Groovy, so I don't know if it does. (I'm trying to debug third-party Groovy code).
Please sign in to leave a comment.
According to the responsible developer it's not supported for Groovy and is unlikely to be possible to support at all.
Thanks for info. Does IntelliJ use the old or new value of the field in the watch point condition?
Depends on how you write the condition, you can use both:
Are you saying that `this.property` is the old value, and `property` is the new value?
If so, then that's what I wanted.
This is how it works for Java code with getters and setters, but it's not supported for Groovy.
That makes sense. Would opening up a ticket in the Groovy issue system for support for this make sense? If so, could someone from the JetBrains debugger and/or groovy team submit it? I assume they’d know the correct wording for such an issue. If submitted, let me know what issue it is and I’ll vote for it. Thanks
Please follow https://youtrack.jetbrains.com/issue/IDEA-235721 for updates. See https://intellij-support.jetbrains.com/hc/articles/207241135 if you are not familiar with YouTrack.
I was looking for how to do this in Java and stumbled across this...
It doesn't seem to work as advertised. Namely, using "hello" seems to get the old value as well. Is there a way to get the new value?
Please share the sample project to reproduce with the screenshots of the conditions you are using: https://uploads.jetbrains.com.
Having trouble uploading so will just copy/paste steps to create it:
Alternatively don't bother with new project and use IntelliJ's lovely scratch file feature.
Thanks for the sample. Please vote for https://youtrack.jetbrains.com/issue/IDEA-205045.
voted, thanks!