10.12.2012 Views

The Java Language Specification, Third Edition

The Java Language Specification, Third Edition

The Java Language Specification, Third Edition

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

15.12.4 Runtime Evaluation of Method Invocation EXPRESSIONS<br />

474<br />

◆ If the MethodName is a qualified name of the form TypeName . Identifier,<br />

then there is no target reference.<br />

◆ If the MethodName is a qualified name of the form FieldName . Identifier,<br />

then there are two subcases:<br />

❖ If the invocation mode is static, then there is no target reference. <strong>The</strong><br />

expression FieldName is evaluated, but the result is then discarded.<br />

❖ Otherwise, the target reference is the value of the expression FieldName.<br />

• If the second production for MethodInvocation, which includes a Primary, is<br />

involved, then there are two subcases:<br />

◆ If the invocation mode is static, then there is no target reference. <strong>The</strong><br />

expression Primary is evaluated, but the result is then discarded.<br />

◆ Otherwise, the expression Primary is evaluated and the result is used as the<br />

target reference.<br />

In either case, if the evaluation of the Primary expression completes abruptly,<br />

then no part of any argument expression appears to have been evaluated, and<br />

the method invocation completes abruptly for the same reason.<br />

• If the third production for MethodInvocation, which includes the keyword<br />

super, is involved, then the target reference is the value of this.<br />

• If the fourth production for MethodInvocation, ClassName.super, is involved,<br />

then the target reference is the value of ClassName.this.<br />

• If the fifth production for MethodInvocation, beginning with<br />

TypeName.NonWildTypeArguments, is involved, then there is no target reference.<br />

DRAFT<br />

15.12.4.2 Evaluate Arguments<br />

<strong>The</strong> process of evaluating of the argument list differs, depending on whether<br />

the method being invoked is a fixed arity method or a variable arity method<br />

(§8.4.1).<br />

If the method being invoked is a variable arity method (§8.4.1) m, it necessarily<br />

has n > 0 formal parameters. <strong>The</strong> final formal parameter of m necessarily has<br />

type T[] for some T, and m is necessarily being invoked with k ≥ 0 actual argument<br />

expressions.<br />

If m is being invoked with k ≠ n actual argument expressions, or, if m is being<br />

invoked with k =<br />

n actual argument expressions and the type of the kth argument

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!