-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
1.0.2
-
sparc
-
generic
Name: ###@###.### Date: 09/05/96
a variable is not considered as definitely assigned after a
compound boolean assignment expression when true though it is
definitely assigned after its right-hand side when true. This
contradicts the following assertion:
Suppose that an assignment expression a = b, a &= b, a |= b, or
a ^= b is boolean-valued.
- V is definitely assigned after a &= b when true iff either a
is V or V would be definitely assigned after a & b (in the same
context) when true.
(Java Language Specification, section 16.1.13)
Test: compilation of the following test
public class test
{
public static void main(String argv[])
{
int i;
boolean [] a = new boolean [10];
a[0] = a[1] = true;
if (a[1] &= a[0] && (i = -1) < 0)
System.out.println(i);
}
}
produces such diagnostics:
novo40% javac test.java
test.java:10: Variable i may not have been initialized.
System.out.println(i);
^
1 error
======================================================================