I have a question.
In my bytecode I calculate statements like if((1==1) && (2==2)){}
with this code:
if (node.getOperator().equals(Operator.LOGICAL_AND)) {
mn.instructions.add(new InsnNode(Opcodes.IAND));
jmp = new JumpInsnNode(Opcodes.IFNE, null);
mn.instructions.add(jmp);
}
What happens is that I need to calculate both operators' expressions right and left in order to have a result. The second way is obvious: if the left expression is zero then leave. In this way, you don't have to calculate both sides.
My question is: Is it wrong to do it the first way?