Java Reference
In-Depth Information
V is definitely unassigned before every return statement that belongs to the try
block.
V is definitely unassigned after e in every statement of the form throw e that be-
longs to the try block.
V is definitely unassigned after every assert statement that occurs in the try
block.
V is definitely unassigned before every break statement that belongs to the try
block and whose break target contains (or is) the try statement.
V is definitely unassigned before every continue statement that belongs to the try
block and whose continue target contains the try statement.
V is definitely unassigned after every catch block of the try statement.
16.3. Definite Assignment and Parameters
• A formal parameter V of a method or constructor (§ 8.4.1 , § 8.8.1 ) is definitely as-
signed (and moreover is not definitely unassigned) before the body of the method
or constructor.
• An exception parameter V of a catch clause (§ 14.20 ) is definitely assigned (and
moreover is not definitely unassigned) before the body of the catch clause.
16.4. Definite Assignment and Array Initializers
V is [un]assigned after an empty array initializer (§ 10.6 ) iff V is [un]assigned be-
fore the empty array initializer.
V is [un]assigned after a non-empty array initializer iff V is [un]assigned after the
last variable initializer in the array initializer.
V is [un]assigned before the first variable initializer of the array initializer iff V is
[un]assigned before the array initializer.
V is [un]assigned before any other variable initializer e of the array initializer iff V
is [un]assigned after the variable initializer to the left of e in the array initializer.
16.5. Definite Assignment and Enum Constants
The rules determining when a variable is definitely assigned or definitely unassigned be-
fore an enum constant (§ 8.9.1 ) are given in § 16.8 .
This is because an enum constant is essentially a static final field (§ 8.3.1.1 , § 8.3.1.2 )
that is initialized with a class instance creation expression (§ 15.9 ) .
Search WWH ::




Custom Search