As an extension the the question "Modify/view static variables while debugging in Eclipse", I'd like to be able to modify static variables while debugging in Eclipse.
For instance and local variables, I can just choose the variable in the "Variables" view of Eclipse, and use the context menu "Change value..." to change the value.
This is not possible for arbitrary static variables, because they do not appear in the "Variables" view.
What I tried:
So, if I have a static variable like a boolean MyClass.disableAllBugs, is there a way to change MyClass.disableAllBugs during debugging?
As an aside: I realize that even having public mutable static fields (i.e. mutable global variables) is very bad style. But some codebases have it, and then it's sometimes useful to modify it while debugging.
You can write a temporary line SomeClass.myStaticVar = newValue;
, select it, right-click and "execute" it.
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