hg: lambda/lambda/langtools: Handle non-static method references from static context. More specifically, if f is an instance method of Z whose signature is A, B->C, then #obj.f is of type A, B->C and #Z.f is of type Z, A, B->C.
Rémi Forax
forax at univ-mlv.fr
Wed Aug 4 08:17:59 PDT 2010
- Previous message: hg: lambda/lambda/langtools: Handle non-static method references from static context. More specifically, if f is an instance method of Z whose signature is A, B->C, then #obj.f is of type A, B->C and #Z.f is of type Z, A, B->C.
- Next message: hg: lambda/lambda/langtools: Handle non-static method references from static context. More specifically, if f is an instance method of Z whose signature is A, B->C, then #obj.f is of type A, B->C and #Z.f is of type Z, A, B->C.
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Le 04/08/2010 16:54, Maurizio Cimadamore a écrit :
> On 04/08/10 15:36, Kevin Bourrillion wrote:
>
>> Hello,
>>
>> Does this mean that we could replace
>>
>> Predicate<Employee> p = { e -> e.isPartTime() };
>>
>> with
>>
>> Predicate<Employee> p = #Employee.isPartTime;
>>
>> ? If so, very cool.
>>
> Yes, the two are the same :-)
>
> Maurizio
>
And the coolest thing is that #Employee.isPartTime is just a LDC.
Predicate<Employee> p = #Employee.isPartTime;
will be compiled to
ldc #Employee.isPartTime
ldc Predicate.class
invokestatic MethodHandles.asSam
(Ljava/lang/MethodHandle;Ljava/lang/Class;)LObject;
checkcast LPredicate;
knowing that asSam() should always return an instance of the same class
for the same SAM.
Rémi
>>
>>
>>
>> On Wed, Aug 4, 2010 at 7:13 AM,<maurizio.cimadamore at oracle.com
>> <mailto:maurizio.cimadamore at oracle.com>> wrote:
>>
>> Changeset: 443eb1d3b96c
>> Author: mcimadamore
>> Date: 2010-08-04 15:10 +0100
>> URL:
>> http://hg.openjdk.java.net/lambda/lambda/langtools/rev/443eb1d3b96c
>>
>> Handle non-static method references from static context. More
>> specifically, if f is an instance method of Z whose signature is
>> A,B->C, then #obj.f is of type A,B->C and #Z.f is of type Z,A,B->C.
>>
>> ! src/share/classes/com/sun/tools/javac/comp/Attr.java
>> ! src/share/classes/com/sun/tools/javac/parser/JavacParser.java
>> ! test/tools/javac/lambda/MethodReference05.java
>> - test/tools/javac/lambda/MethodReference05.out
>> + test/tools/javac/lambda/MethodReference07.java
>> + test/tools/javac/lambda/MethodReference08.java
>> + test/tools/javac/lambda/MethodReference08.out
>> + test/tools/javac/lambda/MethodReference09.java
>> + test/tools/javac/lambda/MethodReference09.out
>>
>>
>>
>>
>>
>> --
>> Kevin Bourrillion @ Google
>> http://guava-libraries.googlecode.com
>>
>>
>
>
- Previous message: hg: lambda/lambda/langtools: Handle non-static method references from static context. More specifically, if f is an instance method of Z whose signature is A, B->C, then #obj.f is of type A, B->C and #Z.f is of type Z, A, B->C.
- Next message: hg: lambda/lambda/langtools: Handle non-static method references from static context. More specifically, if f is an instance method of Z whose signature is A, B->C, then #obj.f is of type A, B->C and #Z.f is of type Z, A, B->C.
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the lambda-dev
mailing list