Java Virtal

[ News ] rss

February 01, 2011

Mark Wielaard: New GPG key. Finally created a new GPG key using gnupg. The old one was a DSA/1024 bits one and 8 years old. The new one is a RSA/2048 bits one. I will use the new one in the future to sign any release tarballs I might create. pub 2048R/57816A6A 2011-01-29 Key f...

More »

February 01, 2011

Andrew Hughes: [SECURITY] IcedTea6 1.7.8, 1.8.5, 1.9.5 Released!. We are pleased to announce a new set of security releases, IcedTea6 1.7.8, IcedTea6 1.8.5 and IcedTea6 1.9.5. This update contains the following security updates: The IcedTea project provides a harness to build the source code from OpenJDK6 u...

More »

9101112 131415

[ Archives News
for 'Java Technology' ]

home > news > java technology > jsr 292 goodness: lambda to sam type conversion using invokedynamic

JSR 292 goodness: Lambda to SAM type conversion using invokedynamic

Happy new year ! We made some interresting progress toward JSRnbsp;292 completion. As John already blogged, the latest build of jdk7 (b123) comes with a nearly up to date version of JSR 292 API. This build introduces a new mechanism that allow to send constant arguments to the bootstrap method of an invokedynamic. This blog entry is about how to use this feature to implement lambda to SAM type conversion. Let suppose I want to translate this following code to bytecode. Comparator c = #{ o1, o2 - 1 }; Currently, the prototype compiler of the lambda project, first create a static method (lambda$1) corresponding to the lambda then create a MethodHandle on this method. This method handle is after translated into an instance of class implementing the interface using a java.lang.reflect.Proxy. Here, the lambda is not bound to any local arguments so the instance of the class Comparator can be created once. Using a trick similar to the one use to implement the DCL Pattern, it can be implemented using invokedynamic. With invokedynamic it#039;s simpler. BecaThere is no Java syntax for invokedynamic, so I can#039;t explain the translation using real Java code but in pseudo Java code, it#039;s something like that: Comparator c = (Comparator) invokedynamic [Lambdas#asSamBSM, #lambda$1, Comparator.class] (); Or using ASM 4, the future version of ASM that supports invokedynamic#039;s boostrap arguments: mv.visitIndyMet...

Date: January, 04 2011

Others News

© free web design software | Mobirise Templates | Bootstrap Templates | bootstrap button styles |