Type annotations for method/ctor reference expressions
alex.buckley at oracle.com
Wed Dec 12 17:40:59 PST 2012
FYI, v0.6 of the JSR 335 spec is at:
and the grammar for method/ctor reference expressions is at:
On 12/11/2012 4:10 PM, Alex Buckley wrote:
> The following productions occur in the latest spec for JSR 335 "Lambda
> expressions" (v0.6 - I will send a URL to a suitably-licensed file
> ExpressionName '::' NonWildTypeArgumentsopt Identifier
> Primary '::' NonWildTypeArgumentsopt Identifier
> 'super' '::' NonWildTypeArgumentsopt Identifier
> TypeName '.' 'super' '::' NonWildTypeArgumentsopt Identifier
> ReferenceType '::' NonWildTypeArgumentsopt Identifier
> ClassType '::' NonWildTypeArgumentsopt 'new'
> ArrayType '::' 'new'
> Some implications for JSR 308:
> 1. The NonWildTypeArguments term in MethodReference and
> ConstructorReference means that type arguments in method/ctor reference
> expressions are annotatable in source according to the current JSR 308
> grammar. (NonWildTypeArguments depends on ReferenceType, which the 308
> grammar makes annotatable.) For the class file, we have a target_type
> constant for method references, but there should be a separate constant
> for ctor references.
> 2. The ReferenceType term in MethodReference means that a type use there
> is annotatable in source. For the class file, a new target_type constant
> is needed.
> 3. The TypeName term in MethodReference should probably be annotatable
> in source. Come to think of it, what about annotating the TypeName in
> T.super.f (JLS 15.11.2)? Has JSR 308 missed this location all along?
> 4. The ClassType and ArrayType terms in ConstructorReference ought to be
> annotatable in source, but the JSR 308 grammar needs to be extended to
> allow this. Then new target_type constants are needed.
More information about the type-annotations-spec-experts