-
Bug
-
Resolution: Fixed
-
P4
-
1.0.2, 1.1, 5.0
-
rc
-
generic, sparc
-
solaris_2.4, solaris_8
Name: swC45995 Date: 11/06/96
The right-hand operand of an assignment expression is evaluated prior
to evaluation of the left-hand operand. It contradicts the following
assertion:
First, the left-hand operand is evaluated to produce a variable. If this evaluation completes abruptly, then the assignment expression completes abruptly for the same reason; the right-hand operand is not evaluated and no assignment occurs. (Java Language Specification, section 15.25.1 Simple Assignment
Operator)
Thus, execution of the following test
public class test
{
int field;
public static void main(String argv[])
{
test x = null;
int a = 0;
try {
x.field = ++a;
} catch (NullPointerException e) {
System.out.println(a);
}
}
}
produces such output:
novo40% java test
1
instead of expected:
novo40% java test
0
======================================================================