-
Bug
-
Resolution: Unresolved
-
P4
-
1.4.0
-
Fix Understood
Considering the tentative decision on 4642762, I presume we should
consider that
in the following program the second break statement is not one that
"may exit the labelled statement" (16.2.5), and that consequently the
program should be accepted by a compiler. A similar issue arises in
the context of 16.2.8 (switch).
If that is our position (and I hope it is), then there are obvious
errors in 16.2.9, 16.2.10 and 16.2.11 (the three loops) which use the
language "V is [un]assigned before every break statement for which the
[loop] statement is the break target." It would be strange to make
accomodation for a finally that cannot complete normally in one
context but not in another context.
class Tnewflow {
void f(int x) {
final int i;
L: {
if (x==0) break L;
try {
i = 3;
break L; // may exit L?
} finally {
return;
}
}
i = 2; // definitely unassigned?
}
}
consider that
in the following program the second break statement is not one that
"may exit the labelled statement" (16.2.5), and that consequently the
program should be accepted by a compiler. A similar issue arises in
the context of 16.2.8 (switch).
If that is our position (and I hope it is), then there are obvious
errors in 16.2.9, 16.2.10 and 16.2.11 (the three loops) which use the
language "V is [un]assigned before every break statement for which the
[loop] statement is the break target." It would be strange to make
accomodation for a finally that cannot complete normally in one
context but not in another context.
class Tnewflow {
void f(int x) {
final int i;
L: {
if (x==0) break L;
try {
i = 3;
break L; // may exit L?
} finally {
return;
}
}
i = 2; // definitely unassigned?
}
}
- relates to
-
JDK-4660984 16.2.12: Clarify DU/DA analysis for loop containing break
- Resolved
-
JDK-8062814 16.2.5: Clarify DU/DA for labeled statement with intervening finally block
- Open
-
JDK-4718134 DA/DU analysis vs break/continue vs finally that cannot complete normally
- Resolved