Java Reference
In-Depth Information
V is [un]assigned before any other statement S of the block iff V is [un]assigned
after the statement immediately preceding S in the block.
We say that V is definitely unassigned everywhere in a block B iff:
V is definitely unassigned before B .
V is definitely assigned after e in every assignment expression V = e , V += e , V -= e ,
V *= e , V /= e , V %= e , V <<= e , V >>= e , V >>>= e , V &= e , V |= e , or V ^= e that oc-
curs in B .
V is definitely assigned before every expression ++ V , -- V , V ++ , or V -- . that occurs in
B .
These conditions are counterintuitive and require some explanation. Consider
a simple assignment V = e . If V is definitely assigned after e , then either:
• The assignment occurs in dead code, and V is vacuously definitely as-
signed. In this case, the assignment will not actually take place, and
we can assume that V is not being assigned by the assignment expres-
sion. Or:
V was already assigned by an earlier expression prior to e . In this case
the current assignment will cause a compile-time error.
So, we can conclude that if the conditions are met by a program that causes no
compile time error, then any assignments to V in B will not actually take place
at run time.
16.2.3. Local Class Declaration Statements
V is [un]assigned after a local class declaration statement (§ 14.3 ) iff V is
[un]assigned before the local class declaration statement.
16.2.4. Local Variable Declaration Statements
V is [un]assigned after a local variable declaration statement (§ 14.4 ) that contains
no variable initializers iff V is [un]assigned before the local variable declaration
statement.
V is definitely assigned after a local variable declaration statement that contains at
least one variable initializer iff either V is definitely assigned after the last variable
initializer in the local variable declaration statement or the last variable initializer
in the declaration is in the declarator that declares V .
V is definitely unassigned after a local variable declaration statement that contains
at least one variable initializer iff V is definitely unassigned after the last variable
Search WWH ::




Custom Search