Java Reference
In-Depth Information
•
V
is definitely assigned before the declaration of a class body of an enum constant
with no arguments that is declared within the scope of
V
iff
V
is definitely assigned
before the enum constant.
•
V
is definitely assigned before the declaration of a class body of an enum constant
with arguments that is declared within the scope of
V
iff
V
is definitely assigned
after the last argument expression of the enum constant
The definite assignment/unassignment status of any construct within the class body of an
enum constant is governed by the usual rules for classes.
•
V
is [un]assigned before the first argument to an enum constant iff it is
[un]assigned before the enum constant.
•
V
is [un]assigned before
y
(an argument of an enum constant, but not the first) iff
V
is [un]assigned after the argument to the left of
y
.
16.6. Definite Assignment and Anonymous Classes
clared within the scope of
V
iff
V
is definitely assigned after the class instance cre-
ation expression that declares the anonymous class.
It should be clear that if an anonymous class is implicitly defined by an enum
constant, the rules of §
16.5
apply.
16.7. Definite Assignment and Member Types
Let
C
be a class, and let
V
be a blank
final
member field of
C
. Then:
•
V
is definitely assigned (and moreover, not definitely unassigned) before the de-
Let
C
be a class declared within the scope of
V
. Then:
•
V
is definitely assigned before a member type declaration of
C
iff
V
is definitely
assigned before the declaration of
C
.
16.8. Definite Assignment and Static Initializers
Let
C
be a class declared within the scope of
V
. Then: