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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

xviii<br />

<strong>The</strong> <strong>Java</strong> <strong>Language</strong> <strong>Specification</strong><br />

15.7.1 Evaluate Left-Hand Operand First 415<br />

15.7.2 Evaluate Operands before Operation 416<br />

15.7.3 Evaluation Respects Parentheses and Precedence 417<br />

15.7.4 Argument Lists are Evaluated Left-to-Right 418<br />

15.7.5 Evaluation Order for Other Expressions 419<br />

15.8 Primary Expressions 420<br />

15.8.1 Lexical Literals 420<br />

15.8.2 Class Literals 421<br />

15.8.3 this 421<br />

15.8.4 Qualified this 422<br />

15.8.5 Parenthesized Expressions 422<br />

15.9 Class Instance Creation Expressions 423<br />

15.9.1 Determining the Class being Instantiated 424<br />

15.9.2 Determining Enclosing Instances 425<br />

15.9.3 Choosing the Constructor and its Arguments 427<br />

15.9.4 Run-time Evaluation of Class Instance Creation Expressions 428<br />

15.9.5 Anonymous Class Declarations 429<br />

15.9.5.1 Anonymous Constructors 429<br />

15.9.6 Example: Evaluation Order and Out-of-Memory Detection 430<br />

15.10 Array Creation Expressions 431<br />

15.10.1 Run-time Evaluation of Array Creation Expressions 432<br />

15.10.2 Example: Array Creation Evaluation Order 433<br />

15.10.3 Example: Array Creation and Out-of-Memory Detection 434<br />

15.11 Field Access Expressions 435<br />

15.11.1 Field Access Using a Primary 435<br />

15.11.2 Accessing Superclass Members using super 438<br />

15.12 Method Invocation Expressions 440<br />

15.12.1 Compile-Time Step 1: Determine Class or Interface to Search 440<br />

15.12.2 Compile-Time Step 2: Determine Method Signature 442<br />

15.12.2.1 Identify Potentially Applicable Methods 443<br />

15.12.2.2 Phase 1: Identify Matching Arity Methods Applicable by Subtyping<br />

445<br />

15.12.2.3 Phase 2: Identify Matching Arity Methods Applicable by<br />

Method Invocation Conversion 446<br />

15.12.2.4 Phase 3: Identify Applicable Variable Arity Methods 446<br />

15.12.2.5 Choosing the Most Specific Method 447<br />

15.12.2.6 Method Result and Throws Types 450<br />

15.12.2.7 Inferring Type Arguments Based on Actual Arguments 451<br />

15.12.2.8 Inferring Unresolved Type Arguments 466<br />

15.12.2.9 Examples 466<br />

15.12.2.10 Example: Overloading Ambiguity 468<br />

15.12.2.11 Example: Return Type Not Considered 468<br />

15.12.2.12 Example: Compile-Time Resolution 469<br />

15.12.3 Compile-Time Step 3: Is the Chosen Method Appropriate? 471<br />

15.12.4 Runtime Evaluation of Method Invocation 473<br />

15.12.4.1 Compute Target Reference (If Necessary) 473<br />

15.12.4.2 Evaluate Arguments 474<br />

15.12.4.3 Check Accessibility of Type and Method 475

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

Saved successfully!

Ooh no, something went wrong!