Sometimes when debugging I put an extra variable in the code so I can then see the value of that variable in the debugger. However it seems that if the extra variable is not used anywhere else in the code then IntelliJ does not include the variable in the debugger. I've gotten around this by declaring a dummy variable and setting it equal to the variable I want to see in the debugger, because that way IntelliJ sees that the extra variable is used.
Is there a way to configure IntelliJ to show unused variables in the debugger?
Since the Java compiler is what removes the unused variables, the solution I found was to configure the Java compiler used by IntelliJ to not remove unused variables.
Specifically in my case I use the Eclipse compiler in IntelliJ, so all I had to do was configure the compiler with the additional command line parameter:
-preserveAllLocals
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