Is It Possible To Automatically Change A Value Whilst Debugging?

已回答

There is a bug in an external library that I am using that causes a NullPointerException.

Therefore, I have put a conditional breakpoint that gets hit when the value is Null and I then modify the variable to be an empty Map.

The trouble is that this happens about 4 times each test and is tedious to set.

Is it possible to have IDEA change the variable to this empty map for  me each time the conditional breakpoint is hit?

0
正式评论

Yes sure, this is possible, just assign a new value in breakpoint's "Evaluate and log" field. Also you can unset "suspend" and the breakpoint will silently reset value when needed.

@Serge you sneaky monkey! You deleted your comment saying it wasn't possible! :)

I had started to use AOP before this answer came in. Talk about overkill!

IDEA FTW!

0

请先登录再写评论。