-
Bug
-
Resolution: Fixed
-
P4
-
1.2.0
-
merlin
-
x86
-
windows_nt
Name: tb29552 Date: 10/01/98
The following code is illegal:
class X
{
static final int i = 1 / 0;
}
The value of this compile-time constant is undefined, therefore this
has to be a compile-time error. Guy Steele confirmed about 18 months
ago that this was indeed the intended behaviour.
A compile-time constant has to have its value available statically (that's
what makes it a compile-time constant ;-) For example, the value of other
constants whose values are determined by a constant that contains a division
by zero are undefined. This affects the semantics of switch statements,
definite assigment and unassignment, etc.
(Review ID: 39565)
======================================================================
- relates to
-
JDK-4089107 javac treats integer division by (constant) zero as an error.
-
- Closed
-
-
JDK-4475252 constant expr limits neglected by vmspec/ 4.10 Limitations
-
- Resolved
-