[type-annos-observers] Type Annotations in the language model API

Alex Buckley alex.buckley at oracle.com
Tue Feb 19 16:19:24 PST 2013


On 2/18/2013 1:03 PM, Alex Buckley wrote:
> As raised by Joe Darcy elsewhere, the language model needs to consider
> the only truly new construct in the language for type annotations: the
> 'this' pseudo-parameter which allows annotations on the type of the
> object on which a method/ctor is invoked.
>
> The question is whether to expose a mirror for that type via:
>
> i) a new method ExecutableElement.getReceiverType() that returns a
> TypeMirror, or

We are working on adding this method.

It will return a TypeMirror which is a DeclaredType if the 
ExecutableElement represents an instance method or an inner constructor.

It will return a TypeMirror which is a NoType (kind NONE) if the 
ExecutableElement represents a static method or an initializer (static 
or instance).

We also plan to add ExecutableType.getReceiverType(), since 
ExecutableType generally follows ExecutableElement in exposing 
sub-structural types, e.g. return type.

It will return a TypeMirror which is a DeclaredType if the 
ExecutableType represents the type of an executable which is an instance 
method or an inner constructor.

It will return a TypeMirror which is a a NoType (kind NONE) if the 
ExecutableType represents the type of an executable which is a static 
method or an initializer (static or instance).

Alex


More information about the type-annotations-spec-observers mailing list