Can creating a method scoped variable for the return value have any downside in Java?

I often use a method scoped variable in order to store the return value in order to make the use of conditional debugger breakpoints more easy:

boolean retValue = some very complex condition;

return retValue;

instead of

return some very complex condition;

because they I can just set !retValue as breakpoint condition and don't even need to maintain that condition after changing some very complex condition.

Is there any possibility that such variables are not removed by the Java compiler when compiling with optimization?

I'm aware that this is considered Code smell because retValue might unintentionally be...

Read More »

By: StackOverFlow - Monday, 16 April

Related Posts