Is Java evaluation order guaranteed in this case of method call and arguments passed in
I did some reading up on JLS 15.7.4 and 15.12.4.2 , but it doesn't guarantee that there won't be any compiler/runtime optimization that would change the order in which method arguments are evaluated. Assume the following code: public static void main (String[] args) { MyObject obj = new MyObject(); methodRelyingOnEvalOrder(obj, obj.myMethod()); } public static Object methodRelyingOnEvalOrder(MyObject obj, Object input) { if (obj.myBoolean()) return null; else return input; } Is it guaranteed that the compiler or runtime will not do a false optimization such as the following? This optimization