Let C be a class declared within the scope of V. Then:
-
V is definitely assigned before a constructor declaration (§8.8.7) or instance variable initializer (§8.3.2) of C iff V is definitely assigned before the declaration of C.
Note that there are no rules that would allow us to conclude that V is definitely unassigned before the constructor declaration or instance variable initializer. We can informally conclude that V is not definitely unassigned before any constructor declaration or instance variable initializer of C, but there is no need for such a rule to be stated explicitly.
Let C be a class, and let V be a blank final non-static member field of C, declared in C. Then:
- V is definitely unassigned (and moreover is not definitely assigned) before the declaration of any constructor in C.
- V is definitely unassigned (and moreover is not definitely assigned) before the leftmost instance initializer (§8.6) or instance variable initializer of C iff V is definitely unassigned after every superclass constructor invocation (§8.8.7.1) in the constructors of C.
- V is definitely assigned (and moreover is not definitely unassigned) before the leftmost instance initializer (§8.6) or instance variable initializer of C iff C declares at least one constructor, every constructor of C has an explicit constructor invocation, and V is definitely assigned after every superclass constructor invocation in these constructors.
- V is [un]assigned before an instance initializer or instance variable initializer of C other than the leftmost iff V is [un]assigned after the preceding instance initializer or instance variable initializer of C.
Let C be a class, and let V be a blank final non-static member field of C, declared in a superclass of C. Then:
- V is definitely unassigned (and moreover is not definitely assigned) before the declaration of any constructor in C.
- V is definitely assigned (and moreover is not definitely unassigned) before every instance initializer and instance variable initializer of C.
Let C be a class, and let V be a blank final static member field of C. Then:
- V is definitely assigned (and moreover is not definitely unassigned) before every constructor declaration, instance initializer, and instance variable initializer of C.
Let C be a class, and let V be a local variable declared by a statement S contained by a constructor or instance variable initializer of C. Then:
- V is definitely unassigned (and moreover is not definitely assigned) before the constructor declaration or instance variable initializer.
The following rules hold within the constructors (§8.8.7) of class C:
-
V is [un]assigned before the prologue of the constructor body (§8.8.7) iff V is [un]assigned before the constructor declaration.
-
V is [un]assigned after an empty prologue iff V is [un]assigned before the prologue.
-
V is [un]assigned after a non-empty prologue iff V is [un]assigned after the last statement in the prologue.
-
V is [un]assigned before a constructor invocation (§8.8.7.1) iff V is [un]assigned after the prologue.
-
V is [un]assigned before the argument list of a qualified super constructor invocation iff V is [un]assigned after the qualifier expression.
-
V is [un]assigned before the argument list of any other constructor invocation iff V is [un]assigned before the invocation.
-
V is [un]assigned after the argument list of a constructor invocation iff either V is [un]assigned after the rightmost argument expression in the argument list, or the argument list is empty and V is [un]assigned before the argument list.
-
A blank
finalnon-staticmember field of C, declared in a superclass of C, is definitely assigned (and moreover is not definitely unassigned) after a superclass constructor invocation. -
Any other variable V is [un]assigned after a superclass constructor invocation iff V is [un]assigned after the argument list of the invocation.
-
A blank
finalnon-staticmember field of C, declared in C or a superclass of C, is definitely assigned (and moreover is not definitely unassigned) after an alternate constructor invocation. -
Any other variable V is [un]assigned after an alternate constructor invocation iff V is [un]assigned after the argument list of the invocation.
-
For the epilogue of a constructor body with no explicit constructor invocation:
- A blank
finalnon-staticmember field V of C, declared in C, is [un]assigned before the epilogue iff either V is [un]assigned after the rightmost instance initialization or instance variable initializer of C, or C declares no instance initializer or instance variable initializer, and V is [un]assigned after the prologue of the constructor body. - A blank
finalnon-staticmember field of C, declared in a superclass of C, is definitely assigned (and moreover is not definitely unassigned) before the epilogue. - Any other variable V is [un]assigned before the epilogue iff V is [un]assigned after the prologue of the constructor body.
- A blank
-
For the epilogue of a constructor body with a superclass constructor invocation:
- A blank
finalnon-staticmember field V of C, declared in C, is [un]assigned before the epilogue iff either V is [un]assigned after the rightmost instance initialization or instance variable initializer of C, or C declares no instance initializer or instance variable initializer, and V is [un]assigned after the superclass constructor invocation. - Any other variable V is [un]assigned before the epilogue iff V is [un]assigned after the superclass constructor invocation.
- A blank
-
For the epilogue of a constructor body with an alternate constructor invocation, V is [un]assigned before the epilogue iff V is [un]assigned after the alternate constructor invocation.
-
V is [un]assigned after an empty epilogue iff V is [un]assigned before the epilogue.
-
V is [un]assigned after a non-empty epilogue iff V is [un]assigned after the last statement in the epilogue.
-
V is [un]assigned before the first statement of the prologue or epilogue iff V is [un]assigned before the prologue or epilogue, respectively.
-
V is [un]assigned before any other statement S in the prologue or epilogue iff V is [un]assigned after the statement immediately preceding S in the prologue or epilogue.
-
V is [un]assigned before the qualifier expression of a super constructor invocation iff V is [un]assigned before the super constructor invocation.
-
V is [un]assigned before the leftmost argument expression of an explicit constructor invocation iff V is [un]assigned before the argument list.
-
V is [un]assigned before any other argument expression
xof an explicit constructor invocation iff V is [un]assigned after the argument expression to the left ofx.