I have code that all over the place(probably 20-30 instances) does this:
<widget>.setVisible((condition == VIEW) || (condition == EDIT));
Logically I do understand that the Java compiler should and probably will optimize this to calculate it up front and simply use the calculated boolean.
My question is is there any way to actually verify that this is the case?
CLARIFICATION
condition is a private class member with no way to modify it past construction.
Disassemble the class file with javap, e.g.
to see the bytecode source. But why not just guarantee the optimization by extracting into a temp boolean variable?