-
Bug
-
Resolution: Fixed
-
P4
-
6
-
None
-
rc
-
generic
-
generic
-
Verified
The section "16.2.15 try Statements" of JLS3 contains the following sentence:
*V is definitely unassigned after e2 in every statement of the form assert e1 : e2 that occurs in the try block.
The question is : what is meant by "V is definitely unassigned after e2"? Is it the same as "V is definitly unassigned after assert statement" from section "16.2.8 assert Statements"?
In other words I would like to know the conditions that must be met for V to be definitely unassigned after e2.
Please, become familiar with the current behaviour of compilator in different cases:
1) try{
assert true: (V = 1);
}catch(...) {
V = 2;
}
Compilation completed successfully
2) try{
assert false: (V = 1);
}catch(...) {
V = 2;
}
1 error:
variable V might already have been assigned
3!) try{
boolean e1;
assert (e1 = true): (V = 1);
}catch(...) {
V = 2;
}
1 error:
variable V might already have been assigned
*V is definitely unassigned after e2 in every statement of the form assert e1 : e2 that occurs in the try block.
The question is : what is meant by "V is definitely unassigned after e2"? Is it the same as "V is definitly unassigned after assert statement" from section "16.2.8 assert Statements"?
In other words I would like to know the conditions that must be met for V to be definitely unassigned after e2.
Please, become familiar with the current behaviour of compilator in different cases:
1) try{
assert true: (V = 1);
}catch(...) {
V = 2;
}
Compilation completed successfully
2) try{
assert false: (V = 1);
}catch(...) {
V = 2;
}
1 error:
variable V might already have been assigned
3!) try{
boolean e1;
assert (e1 = true): (V = 1);
}catch(...) {
V = 2;
}
1 error:
variable V might already have been assigned
- relates to
-
JDK-4643292 definite unassignment versus assertions
-
- Closed
-