Java Reference
In-Depth Information
field access expressions, named method invocations with no arguments, and un-
qualified superclass method invocations with no arguments.
• If the expression has subexpressions, V is [un]assigned after the expression iff V is
[un]assigned after its rightmost immediate subexpression.
There is a piece of subtle reasoning behind the assertion that a variable V
can be known to be definitely unassigned after a method invocation. Taken
by itself, at face value and without qualification, such an assertion is not al-
ways true, because an invoked method can perform assignments. But it must
be remembered that, for the purposes of the Java programming language, the
concept of definite unassignment is applied only to blank final variables. If V
is a blank final local variable, then only the method to which its declaration
belongs can perform assignments to V . If V is a blank final field, then only
a constructor or an initializer for the class containing the declaration for V
can perform assignments to V ; no method can perform assignments to V . Fin-
ally, explicit constructor invocations (§ 8.8.7.1 ) are handled specially (§ 16.9 );
although they are syntactically similar to expression statements containing
method invocations, they are not expression statements and therefore the rules
of this section do not apply to explicit constructor invocations.
For any immediate subexpression y of an expression x , V is [un]assigned before y iff one of
the following situations is true:
y is the leftmost immediate subexpression of x and V is [un]assigned before x .
y is the right-hand operand of a binary operator and V is [un]assigned after the left-
hand operand.
x is an array access, y is the subexpression within the brackets, and V is
[un]assigned after the subexpression before the brackets.
x is a primary method invocation expression, y is the first argument expression in
the method invocation expression, and V is [un]assigned after the primary expres-
sion that computes the target object.
x is a method invocation expression or a class instance creation expression; y is an
argument expression, but not the first; and V is [un]assigned after the argument ex-
pression to the left of y .
x is a qualified class instance creation expression, y is the first argument expression
in the class instance creation expression, and V is [un]assigned after the primary
expression that computes the qualifying object.
Search WWH ::




Custom Search