hg: lambda/lambda/langtools: Fix: Add extra checks when lambda/method ref is converted to intersection type

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Mon Dec 10 07:54:01 PST 2012


On 28/11/12 18:41, Boaz Nahum wrote:
> Can you explain why?
> If I1 and I2 have same SAM why (I1 & I2) is not valid?
> Can also explain why the order does matter?
I forgot to reply on this one - the idea is that type-erasuer already 
introduce order-dependency on intersection types (i.e. the erasure of A 
& B & C is A). So it makes sense to give special properties to the first 
type of an intersection in the context of a SAM conversion.

Maurizio

> Thx
> (sorry foy English )
> Boaz
> On Nov 28, 2012 12:34 PM, <maurizio.cimadamore at oracle.com> wrote:
>
>> Changeset: 7fa8e7c02baa
>> Author:    mcimadamore
>> Date:      2012-11-28 10:31 +0000
>> URL:
>> http://hg.openjdk.java.net/lambda/lambda/langtools/rev/7fa8e7c02baa
>>
>> Fix: Add extra checks when lambda/method ref is converted to intersection
>> type
>>
>> A lambda/methdod reference can be converted to an intersection type
>> provided that:
>>
>> *) All types in the intersection are interface types
>> *) The first type of the intersection is a functional interface
>> *) The additional bounds of the intersection are marker interfaces
>>
>> ! src/share/classes/com/sun/tools/javac/code/Type.java
>> ! src/share/classes/com/sun/tools/javac/code/Types.java
>> ! src/share/classes/com/sun/tools/javac/comp/Attr.java
>> ! src/share/classes/com/sun/tools/javac/resources/compiler.properties
>> ! test/tools/javac/diags/examples.not-yet.txt
>> + test/tools/javac/lambda/intersection/IntersectionTargetTypeTest.java
>>
>>
>>



More information about the lambda-dev mailing list