RAnders00 February 2016

Debugging inlined values in IntelliJ IDEA

Consider the following line of Java code (it's just pseudo code to demonstrate the scenario):

someObject.performAction(Integer.parseInt(other.transform(123)), MessageFormat.format(input, arg, processArg(arg2), anotherValue));

When coming along this line when debugging in IntelliJ IDEA, how can I first see the result of the inlined calls before calling someObject.performAction without refactoring them out into local variables?

Answers


Steve Bosman February 2016

You can't 100% safely do it.

If the inline methods have no side effects select the method call, e.g. processArg(arg2) and use "Evaluate expression" (Alt-F8). This result won't be used when when the debugger is told to continue running the code, so methods with side effects will be evaluated at least twice (once each time "Evaluate expression" is used, and once for the true call).

Post Status

Asked in February 2016
Viewed 2,757 times
Voted 8
Answered 1 times

Search




Leave an answer