NoobieNoob
NoobieNoob

Reputation: 907

IntellJ debugger: Can I always apply an expression automatically at a breakpoint?

Is there any way in IntelliJ's debugger to always:

a) set result to true or

b) make foo() return true

I know that I can change the variable when I am in a breakpoint, but I want it to happen always and automatically, without changing the code because it is a decompiled class.

public void foo() {
   boolean result = false;
   ..
   return result;
}

Upvotes: 5

Views: 61

Answers (1)

Egor
Egor

Reputation: 2674

Add a breakpoint on the line with return, in breakpoint properties unset "suspend", set "evaluate and log" to result = true.

If there are more than one return in the method, you'll need to modify the result value before all of them.

enter image description here

Upvotes: 1

Related Questions