-
Bug
-
Resolution: Fixed
-
P4
-
1.4.0
-
Verified
The last paragraph in JLS 15.14.1 suggests that this is illegal
final int i;
i++;
but it is not clear if that is a normative rule or intended to be
a consequence of other rules. For example, one could imagine the
rule not applying in the following code, where i is both DA and DU:
final int i;
if (false) i++;
Similarly, section 15.26 (last paragraph) has similar language, but
it seems to make some allowance for blank finals. Again, it is not
clear if this rule is intended to be normative.
We should have a consistent story for these two paragraphs, and we
should decide and make clear if this restriction is normative or a
consequence of rules elsewhere. Whichever way this is resolved,
the compiler will need to be checked for compliance.
final int i;
i++;
but it is not clear if that is a normative rule or intended to be
a consequence of other rules. For example, one could imagine the
rule not applying in the following code, where i is both DA and DU:
final int i;
if (false) i++;
Similarly, section 15.26 (last paragraph) has similar language, but
it seems to make some allowance for blank finals. Again, it is not
clear if this rule is intended to be normative.
We should have a consistent story for these two paragraphs, and we
should decide and make clear if this restriction is normative or a
consequence of rules elsewhere. Whichever way this is resolved,
the compiler will need to be checked for compliance.
- relates to
-
JDK-7004835 Different handling for final in constructor
-
- Closed
-