Type Annotations and Lambda
maurizio.cimadamore at oracle.com
Tue Feb 5 14:52:16 PST 2013
On 05/02/13 22:19, Werner Dietl wrote:
> Dear all,
> I implemented method and constructor reference type arguments
> (METHOD_REFERENCE_TYPE_ARGUMENT and
> CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT) in this changeset:
> This resolves the crash noticed by Steve and implements correct
> bytecode storage.
> More extensive tests would be great. I no longer manage to crash the
> compiler with any type annotation uses in lambda.
> I am waiting on a specification clarification from Mike and/or Alex
> about METHOD_REFERENCE_RECEIVER and CONSTRUCTOR_REFERENCE_RECEIVER.
> To me these don't look like type uses, but instead only like scoping
> mechanisms, for which we don't support type annotations.
> It would be great to see a few examples of type uses for these and
> what the interpretation of type annotations should be.
There are several kinds of method references - the so-called unbound
kind has a type as a qualifier - i.e.
Constructor references also have a type as a qualifier:
I don't have specific ideas on what type annotations on such elements
would be - but perhaps, if an annotation is put i.e. on the type of a
qualifier of a method reference it could be used by a checker as a way
to 'filter' the set of valid types that can be used as a target for this
> Finally, the spec says that type annotations in the signature or body
> of a lambda expression should appear in the method that results from
> I was hoping that this would work without any special effort. However,
> no type annotations appear in a translated method.
> Could somebody point me to the location in the code that translates a
> lambda expression into a method?
This is the place:
> cu, WMD.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the type-annotations-dev