hg: lambda/lambda/langtools: Improved support for lambda conversion.
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Mon Jun 21 08:31:55 PDT 2010
Hi Neal
we are still working out the details; see comments inline:
On 21/06/10 15:11, Neal Gafter wrote:
> Maurizio-
>
> What are the rules about checked exceptions thrown by the constructor?
It would seem sensible to enforce clients to catch those exceptions
> What accessibility rules are enforced for the constructor?
I'd say that public/protected no-arg constructor would be fine
> How are the constructor's type parameters inferred?
I'd say that, given the strawman spec doesn't allow SAM types defining
generic methods, a similar ban should apply to SAM types defining a
generic no-arg constructor.
> Is there any way to access the SAM class from within the lambda?
>
No. And I think there shouldn't be any. If we did that we would split
the set of lambda expressions in two subets, lambda that can be used
only within a lambda conversion, and all other lambdas.
Maurizio
> -Neal
>
> On Jun 21, 2010, at 5:47 AM, maurizio.cimadamore at oracle.com wrote:
>
>
>> Changeset: 02b8de982628
>> Author: mcimadamore
>> Date: 2010-06-21 13:43 +0100
>> URL: http://hg.openjdk.java.net/lambda/lambda/langtools/rev/02b8de982628
>>
>> Improved support for lambda conversion.
>>
>> Now the prototype supports lambda conversion where the target type is an abstract class. This is (temporarily) done by generating a synthetic anonymous inner class implementing the SAM method. Also added some checks involving lambda conversion described in the strawman:
>>
>> *) abstract class targeted by a lambda conversion must have default constructor
>> *) target method of lambda conversion cannot be generic
>>
>> ! src/share/classes/com/sun/tools/javac/code/Types.java
>> ! src/share/classes/com/sun/tools/javac/comp/Lower.java
>> ! src/share/classes/com/sun/tools/javac/resources/compiler.properties
>> + test/tools/javac/lambda/BadConv01.java
>> + test/tools/javac/lambda/BadConv01.out
>> + test/tools/javac/lambda/BadConv02.java
>> + test/tools/javac/lambda/BadConv02.out
>> + test/tools/javac/lambda/LambdaConv07.java
>>
>>
>>
More information about the lambda-dev
mailing list