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)
======================================================================