lambda binary snapshots
Mike Duigou
mike.duigou at oracle.com
Sat Nov 12 09:06:58 PST 2011
Here's a version of the weaving instructions:
In order to test the lambda functional interfaces it's necessary to pre-link the extension methods aka "weaving" for classes which inherit extension methods..
The current lambda workspace will weave rt.jar if the defender prototype weaver is located in a peer directory:
~/
code/
jdk8/
defender-prototype/ (http://hg.openjdk.java.net/lambda/defender-prototype/)
lambda/ (http://hg.openjdk.java.net/lambda/lambda)
If you are writing code which uses extension methods or implements interfaces with extension methods you will need to weave those classes before running using current VMs. The weaver can weave either a directory or a jar to another jar or directory. It can't weave in-place. This is the command used to weave rt.jar:
$(BOOT_JAVA_CMD) -cp ../../../../defender-prototype/distrib/jsr335-agent.jar:../../../../defender-prototype/lib/asm-all-4.0.jar jsr335.agent.batch.Main -v -d rt.jar rt-preweave.jar
source (-d) is rt-preweave.jar
destination (parameter) is rt.jar
Once woven the classes will be usable with current JVMs including the one provided in the lambda binary snapshot.
The defender prototype currently requires
TestNG 6.2 or 6.3 (both seem to work)
Asm 4.0 RC 1 <-- *Important* Other versions won't work due to API changes.
Mike
On Nov 12 2011, at 07:48 , Brian Goetz wrote:
> Good question. It is currently pretty limited. The compiler accepts interfaces with extension methods and enforces the typing rules, and emits correct class files. The VM support for inheriting behavior from interfaces is not there yet. But, we do have a prototype tool for simulating the VM behavior through bytecode weaving, and the build for this binary download runs this weaving tool on the JDK libraries, so that the few extension methods that are in the libraries behave correctly in the JDK classes. So, for example, the extension methods from Iterable will show up on JDK implementations of Iterable like ArrayList, but not on a custom user implementation of List (yet).
>
> The weaving tool is open-source but not part of this binary distribution. We plan to post instructions for trying it out if you want to use extension methods in your own code.
>
>
> On Nov 12, 2011, at 4:10 PM, Colin Decker wrote:
>
>> Thanks for putting out these snapshots!
>>
>> To what degree are extension methods supposed to be working in this build?
>> They seem to work for subclasses of Iterable, except those that were
>> compiled with a previous version of Java, for which I get an
>> AbstractMethodError. I also tried adding extension methods to an interface
>> of my own... it compiles, but gives an AbstractMethodError as well.
>>
>> --
>> Colin
>>
>>
>> On Fri, Nov 11, 2011 at 12:27 PM, Maurizio Cimadamore <
>> maurizio.cimadamore at oracle.com> wrote:
>>
>>> Dear lambditizens,
>>> I'm glad to announce that the first binary snapshots of the lambda
>>> repository are available at the following URL:
>>>
>>> http://jdk8.java.net/lambda/
>>>
>>> As you can imagine, as the implementation of the compiler/libraries is
>>> still under heavy development, there are still many rough corners that
>>> need to be polished. I'd like to thank you all for all the patience and
>>> the valuable feedback provided so far - please keep it coming!
>>>
>>> I'd also like to thank Brian, Dan, Mike, Stuart and Mike for their
>>> effort in making this happen.
>>>
>>> Enjoy.
>>>
>>> Maurizio
>>>
>>>
>>
>
>
More information about the lambda-dev
mailing list