eclipse-jdt / eclipse-jdt/eclipse.jdt.debug
Design/Usage of Conditional Watchpoints
- Dominant language
- Java
- Stars
- 23
- Forks
- 68
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 13
Description
I'm trying to make use of conditional watchpoints for debugging my Java code.
In the snippet below, I created a watchpoint on
- EvalJavaConditionWatchpoint.str1
- EvalJavaConditionWatchpoint.NestedClass.str2
If I add a conditional expression for str2, auto-completion encourages me to enter something like
- System.out.println(this.str2)
but then fails on running with
- Conditional breakpoint has compilation error: str2 cannot be resolved or is not a field
If debug the app by having
- System.out.println(this)
for both fields as conditionals, I get
EvalJavaConditionWatchpoint@4cdf35a9
EvalJavaConditionWatchpoint$CallNestedClass@5eb5c224
EvalJavaConditionWatchpoint$CallNestedClass@53e25b76
So it seems the this variable is referencing to the caller instead of the referenced instance where the watchpoint is active.
I suppose this is a bug as also auto-completion proposes a different use of the this variable.
I was also also looking for some documentation about this feature, but was not able to find such - where could I find it?
Thanks,
Thomas
```
public class EvalJavaConditionWatchpoint {
public static void main(String[] args) {
new EvalJavaConditionWatchpoint().run();
}
void run() {
str1 = "abc";
new CallNestedClass().run();
new CallNestedClass().run();
}
String str1;
static class CallNestedClass {
void run() {
NestedClass nc = new NestedClass();
nc.str2 = "abc";
}
}
static class NestedClass {
String str2;
}
}
```
Contributor guide
Assessment
This issue has not been assessed yet.