Groovy Language Specification  
First Draft  
Chapter 15

Expressions

The organization of this chapter parallels the chapter on Expressions in the Java Language Specification (second edition), which begins as follows:
Much of the work in a program is done by evaluating expressions, either for their side effects, such as assignments to variables, or for their values, which can be used as arguments or operands in larger expressions, or to affect the execution sequence in statements, or both.
This chapter specifies the meanings of expressions and the rules for their evaluation.

15.1 Evaluation, Denotation, and Result

(Cf. JLS. §15.1.)

TO DO

15.2 Variables as Values

(Cf. JLS. §15.2.)

TO DO

15.3 Type of an Expression

(Cf. JLS. §15.3.)

TO DO

15.4 FP-strict Expressions

(Cf. JLS. §15.4.)

TO DO

15.5 Expressions and Run-Time Checks

(Cf. JLS. §15.5.)

TO DO

15.6 Normal and Abrupt Completion of Evaluation

(Cf. JLS. §15.6.)

TO DO

15.7 Evaluation Order

(Cf. JLS. §15.7.)

TO DO

15.7.1 Evaluate Left-Hand Operand First

(Cf. JLS. §15.7.1.)

TO DO

15.7.2 Evaluate Operands before Operation

(Cf. JLS. §15.7.2.)

TO DO

15.7.3 Evaluation Respects Parentheses and Precedence

(Cf. JLS. §15.7.3.)

TO DO

15.7.4 Argument Lists are Evaluated Left-to-Right

(Cf. JLS. §15.7.4.)

TO DO

15.7.5 Evaluation Order for Other Expressions

(Cf. JLS. §15.7.5.)

TO DO

15.8 Primary Expressions

(Cf. JLS. §15.8.)

TO DO

15.8.1 Lexical Literals

(Cf. JLS. §15.8.1.)

TO DO

15.8.2 Class Literals

(Cf. JLS. §15.8.2.)

TO DO

15.8.3 <code>this </h3>

(Cf. JLS. §15.8.3.)

TO DO

15.8.4 Qualified <code>this</h3>

(Cf. JLS. §15.8.4.)

TO DO

15.8.5 Parenthesized Expressions

(Cf. JLS. §15.8.5.)

TO DO

15.9 Class Instance Creation Expressions

(Cf. JLS. §15.9.)

TO DO

15.9.1 Determining the Class being Instantiated

(Cf. JLS. §15.9.1.)

TO DO

15.9.2 Determining Enclosing Instances

(Cf. JLS. §15.9.2.)

TO DO

15.9.3 Choosing the Constructor and its Arguments

(Cf. JLS. §15.9.3.)

TO DO

15.9.4 Run-time Evaluation of Class Instance Creation Expressions

(Cf. JLS. §15.9.4.)

TO DO

15.9.5 Anonymous Class Declarations

(Cf. JLS. §15.9.5.)

TO DO

15.9.5.1 Anonymous Constructors

(Cf. JLS. §15.9.5.1.)

TO DO

15.9.6 Example: Evaluation Order and Out-of-Memory Detection

(Cf. JLS. §15.9.6.)

TO DO

15.10 Array Creation Expressions

(Cf. JLS. §15.10.)

TO DO

15.10.1 Run-time Evaluation of Array Creation Expressions

(Cf. JLS. §15.10.1.)

TO DO

15.10.2 Example: Array Creation Evaluation Order

(Cf. JLS. §15.10.2.)

TO DO

15.10.3 Example: Array Creation and Out-of-Memory Detection

(Cf. JLS. §15.10.3.)

TO DO

15.11 Field Access Expressions

(Cf. JLS. §15.11.)

TO DO

15.11.1 Field Access Using a Primary

(Cf. JLS. §15.11.1.)

TO DO

15.11.2 Accessing Superclass Members using <code>super</h3>

(Cf. JLS. §15.11.2.)

TO DO

15.12 Method Invocation Expressions

(Cf. JLS. §15.12.)

TO DO

15.12.1 Compile-Time Step 1: Determine Class or Interface to Search

(Cf. JLS. §15.12.1.)

TO DO

15.12.2 Compile-Time Step 2: Determine Method Signature

(Cf. JLS. §15.12.2.)

TO DO

15.12.2.1 Find Methods that are Applicable and Accessible

(Cf. JLS. §15.12.2.1.)

TO DO

15.12.2.2 Choose the Most Specific Method

(Cf. JLS. §15.12.2.2.)

TO DO

15.12.2.3 Example: Overloading Ambiguity

(Cf. JLS. §15.12.2.3.)

TO DO

15.12.2.4 Example: Return Type Not Considered

(Cf. JLS. §15.12.2.4.)

TO DO

15.12.2.5 Example: Compile-Time Resolution

(Cf. JLS. §15.12.2.5.)

TO DO

15.12.3 Compile-Time Step 3: Is the Chosen Method Appropriate?

(Cf. JLS. §15.12.3.)

TO DO

15.12.4 Runtime Evaluation of Method Invocation

(Cf. JLS. §15.12.4.)

TO DO

15.12.4.1 Compute Target Reference (If Necessary)

(Cf. JLS. §15.12.4.1.)

TO DO

15.12.4.2 Evaluate Arguments

(Cf. JLS. §15.12.4.2.)

TO DO

15.12.4.3 Check Accessibility of Type and Method

(Cf. JLS. §15.12.4.3.)

TO DO

15.12.4.4 Locate Method to Invoke

(Cf. JLS. §15.12.4.4.)

TO DO

15.12.4.5 Create Frame, Synchronize, Transfer Control

(Cf. JLS. §15.12.4.5.)

TO DO

15.12.4.6 Example: Target Reference and Static Methods

(Cf. JLS. §15.12.4.6.)

TO DO

15.12.4.7 Example: Evaluation Order

(Cf. JLS. §15.12.4.7.)

TO DO

15.12.4.8 Example: Overriding

(Cf. JLS. §15.12.4.8.)

TO DO

15.12.4.9 Example: Method Invocation using super

(Cf. JLS. §15.12.4.9.)

TO DO

15.13 Array Access Expressions

(Cf. JLS. §15.13.)

TO DO

15.13.1 Runtime Evaluation of Array Access

(Cf. JLS. §15.13.1.)

TO DO

15.13.2 Examples: Array Access Evaluation Order

(Cf. JLS. §15.13.2.)

TO DO

15.14 Postfix Expressions

(Cf. JLS. §15.14.)

TO DO

15.14.1 Postfix Increment Operator ++

(Cf. JLS. §15.14.1.)

TO DO

15.14.2 Postfix Decrement Operator --

(Cf. JLS. §15.14.2.)

TO DO

15.15 Unary Operators

(Cf. JLS. §15.15.)

TO DO

15.15.1 Prefix Increment Operator ++

(Cf. JLS. §15.15.1.)

TO DO

15.15.2 Prefix Decrement Operator --

(Cf. JLS. §15.15.2.)

TO DO

15.15.3 Unary Plus Operator +

(Cf. JLS. §15.15.3.)

TO DO

15.15.4 Unary Minus Operator -

(Cf. JLS. §15.15.4.)

TO DO

15.15.5 Bitwise Complement Operator ~

(Cf. JLS. §15.15.5.)

TO DO

15.15.6 Logical Complement Operator !

(Cf. JLS. §15.15.6.)

TO DO

15.16 Cast Expressions

(Cf. JLS. §15.16.)

TO DO

15.17 Multiplicative Operators

(Cf. JLS. §15.17.)

TO DO

15.17.1 Multiplication Operator *

(Cf. JLS. §15.17.1.)

TO DO

15.17.2 Division Operator /

(Cf. JLS. §15.17.2.)

TO DO

15.17.3 Remainder Operator %

(Cf. JLS. §15.17.3.)

TO DO

15.18 Additive Operators

(Cf. JLS. §15.18.)

TO DO

15.18.1 String Concatenation Operator +

(Cf. JLS. §15.18.1.)

TO DO

15.18.1.1 String Conversion

(Cf. JLS. §15.18.1.1.)

TO DO

15.18.1.2 Optimization of String Concatenation

(Cf. JLS. §15.18.1.2.)

TO DO

15.18.1.3 Examples of String Concatenation

(Cf. JLS. §15.18.1.3.)

TO DO

15.18.2 Additive Operators (+ and -) for Numeric Types

(Cf. JLS. §15.18.2.)

TO DO

15.19 Shift Operators

(Cf. JLS. §15.19.)

TO DO

15.20 Relational Operators

(Cf. JLS. §15.20.)

TO DO

15.20.1 Numerical Comparison Operators <, <=, >, and >=

(Cf. JLS. §15.20.1.)

TO DO

15.20.2 Type Comparison Operator instanceof

(Cf. JLS. §15.20.2.)

TO DO

15.21 Equality Operators

(Cf. JLS. §15.21.)

TO DO

15.21.1 Numerical Equality Operators == and !=

(Cf. JLS. §15.21.1.)

TO DO

15.21.2 Boolean Equality Operators == and !=

(Cf. JLS. §15.21.2.)

TO DO

15.21.3 Reference Equality Operators == and !=

(Cf. JLS. §15.21.3.)

TO DO

15.22 Bitwise and Logical Operators

(Cf. JLS. §15.22.)

TO DO

15.22.1 Integer Bitwise Operators &, ^, and |

(Cf. JLS. §15.22.1.)

TO DO

15.22.2 Boolean Logical Operators &, ^, and |

(Cf. JLS. §15.22.2.)

TO DO

15.23 Conditional-And Operator &&

(Cf. JLS. §15.23.)

TO DO

15.24 Conditional-Or Operator ||

(Cf. JLS. §15.24.)

TO DO

15.25 Conditional Operator ? :

(Cf. JLS. §15.25.)

TO DO

15.26 Assignment Operators

(Cf. JLS. §15.26.)

TO DO

15.26.1 Simple Assignment Operator =

(Cf. JLS. §15.26.1.)

TO DO

15.26.2 Compound Assignment Operators

(Cf. JLS. §15.26.2.)

TO DO

15.27 Expression

(Cf. JLS. §15.27.)

TO DO

15.28 Constant Expression

(Cf. JLS. §15.28.)

TO DO


Specification Table of Contents.

The organization of this chapter parallels the chapter on Expressions in the Java Language Specification (second edition).

The original of this specification is at http://docs.codehaus.org/display/GroovyJSR.