-
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
simple 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 is definitely assigned after the right-hand operand
expression 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 = 777, j;
boolean b = true;
if (b = i > 0 && (j = -1) < 0)
System.out.println(j);
}
}
produces such diagnostics:
novo40% javac test.java
test.java:9: Variable j may not have been initialized.
System.out.println(j);
^
1 error
======================================================================