tag:blogger.com,1999:blog-243186646627646561.post606101080062873412..comments2024-01-09T13:14:45.812+02:00Comments on Esko Luontola: Lambda Expressions Backported to Java 7, 6 and 5Esko Luontolahttp://www.blogger.com/profile/03956946511109435404noreply@blogger.comBlogger37125tag:blogger.com,1999:blog-243186646627646561.post-41482219644510289862015-10-03T23:00:02.948+03:002015-10-03T23:00:02.948+03:00The RunnableTest class is either missing from the ...The RunnableTest class is either missing from the list of classes to be processed by Retrolambda, or something recompiles it after it was processed.Esko Luontolahttps://www.blogger.com/profile/03956946511109435404noreply@blogger.comtag:blogger.com,1999:blog-243186646627646561.post-30743753700063440472015-10-02T14:30:59.676+03:002015-10-02T14:30:59.676+03:00Hi Esko,
I have ran " java -jar retrolambda.j...Hi Esko,<br />I have ran " java -jar retrolambda.jar " on command line and it worked fine.Also in my eclipse I set Jdk 1.7 for running the code and jdk 1.8 for compiling the code.But when I run the code it give me this error "Exception in thread "main" java.lang.UnsupportedClassVersionError: RunnableTest : Unsupported major.minor version 52.0"<br />Do you think I have missed any step ? Thanksleenahttps://www.blogger.com/profile/09859375938247618586noreply@blogger.comtag:blogger.com,1999:blog-243186646627646561.post-80543640424798174322015-02-04T14:11:53.536+02:002015-02-04T14:11:53.536+02:00This comment has been removed by the author.Anonymoushttps://www.blogger.com/profile/04567958760932508247noreply@blogger.comtag:blogger.com,1999:blog-243186646627646561.post-16051542393964197582015-02-04T14:11:00.571+02:002015-02-04T14:11:00.571+02:00I agree with you.I agree with you.Anonymoushttps://www.blogger.com/profile/04567958760932508247noreply@blogger.comtag:blogger.com,1999:blog-243186646627646561.post-48180152318541064932014-05-14T13:59:39.414+03:002014-05-14T13:59:39.414+03:00This is indeed a great news. If we can use lambda ...This is indeed a great news. If we can use <a href="http://javarevisited.blogspot.com/2014/02/10-example-of-lambda-expressions-in-java8.html" rel="nofollow">lambda expression</a> with its full glory in Java 6 or Java 7, then there would be lot of people who can use it, as upgrading to Java 8 is not as easy in big companies as for your fun project.Anonymoushttps://www.blogger.com/profile/14711740575876145166noreply@blogger.comtag:blogger.com,1999:blog-243186646627646561.post-84460154506999212612014-05-12T02:14:55.374+03:002014-05-12T02:14:55.374+03:00Thanks for this awesome tool! It works pretty well...Thanks for this awesome tool! It works pretty well for me.<br /><br />For what it's worth (Caution: shamleless plug): I've attempted a backport of the java.util.stream API to Java 6, using your retrolambda, that, at first sigth, appears to hold the water.<br /><br />https://sourceforge.net/projects/streamsupport/?source=directory<br /><br />If anyone is interested: It's still in early alpha, so don't expect too much yet.Stefan Zobelhttps://www.blogger.com/profile/12639995058240242348noreply@blogger.comtag:blogger.com,1999:blog-243186646627646561.post-78804773533593868512014-03-31T17:37:39.549+03:002014-03-31T17:37:39.549+03:00i could narrow it down to the ant task i was build...i could narrow it down to the ant task i was building, turns out the classpath-property wasn't set correctlyAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-243186646627646561.post-68550468363256638332014-03-30T23:52:07.527+03:002014-03-30T23:52:07.527+03:00Now that's funny, because I have absolutely no...Now that's funny, because I have absolutely no problems doing that with with Retrolambda: https://gist.github.com/orfjackal/9879520Esko Luontolahttps://www.blogger.com/profile/03956946511109435404noreply@blogger.comtag:blogger.com,1999:blog-243186646627646561.post-79041482286815815772014-03-29T16:20:12.685+02:002014-03-29T16:20:12.685+02:00myjButton.addActionlistener( e -> someMethod())...myjButton.addActionlistener( e -> someMethod());<br /><br />tells me invokespecial is not supportedAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-243186646627646561.post-73629369935043195022014-03-29T11:17:48.013+02:002014-03-29T11:17:48.013+02:00I don't quite follow you that what do you mean...I don't quite follow you that what do you mean by it not supporting invokespecial. Please give an example of Java 8 source code that doesn't work with Retrolambda.Esko Luontolahttps://www.blogger.com/profile/03956946511109435404noreply@blogger.comtag:blogger.com,1999:blog-243186646627646561.post-80166266914491637032014-03-29T02:06:24.981+02:002014-03-29T02:06:24.981+02:00Nice project, but unfortunately doesnt support &qu...Nice project, but unfortunately doesnt support "invokespecial" which is my main usecase...<br /><br />so i started a sourcecode patching project https://github.com/wolfposd/to7andbeyond<br /><br />currently its really rudimentary and only changes oneliners, but already suits my needsAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-243186646627646561.post-74845156524498001962014-01-14T22:51:27.751+02:002014-01-14T22:51:27.751+02:00... but still I think it's great idea :)
And ...... but still I think it's great idea :)<br /><br />And it will be useful for e.g. some API development on java 8 and re-distribute to older version. There is less code maintenance.<br /><br />I think its good approach to scan superclasses and interfaces for default method, and after collecting them all, import them in 'root' class. I'm not so much in bytecode but who knows with proper motivation and time...<br /><br />In short..you do pretty awesome yob!<br />best regardsAnonymoushttps://www.blogger.com/profile/10326297891168555947noreply@blogger.comtag:blogger.com,1999:blog-243186646627646561.post-20905403409323005682014-01-14T21:45:53.036+02:002014-01-14T21:45:53.036+02:00No. I think that it would be hard to fully backpor...No. I think that it would be hard to fully backport default interfaces, because they support polymorphism. One option might be to find all implementors of an interface that uses default methods, and copy the method implementation there, unless that class or its superclasses has an implementation. But I don't think that it would be worth the effort, because that alone would not give you the new JDK 8 APIs that were the reason for adding default methods in the first place.Esko Luontolahttps://www.blogger.com/profile/03956946511109435404noreply@blogger.comtag:blogger.com,1999:blog-243186646627646561.post-72057923774847891362014-01-14T10:37:25.358+02:002014-01-14T10:37:25.358+02:00Hi Esko
haven't you tried to resolve problem o...Hi Esko<br />haven't you tried to resolve problem of default interfaces? This is another feature that breaks our backporting from jdk 8 to 6. <br /><br />-TomasTomas Brandalikhttps://www.blogger.com/profile/11660715343526841288noreply@blogger.comtag:blogger.com,1999:blog-243186646627646561.post-68156501598281733502014-01-08T00:34:37.537+02:002014-01-08T00:34:37.537+02:00Thanks for reporting the problem. A recent JDK 8 h...Thanks for reporting the problem. A recent JDK 8 had changes which made it incompatible with Retrolambda 1.1.1. I have now released Retrolambda 1.1.2 which fixes the problem.Esko Luontolahttps://www.blogger.com/profile/03956946511109435404noreply@blogger.comtag:blogger.com,1999:blog-243186646627646561.post-74621647844983185742014-01-06T21:29:52.630+02:002014-01-06T21:29:52.630+02:00Must be some stupid mistake, but I can't see i...Must be some stupid mistake, but I can't see it. I tried to reproduce the example for Dalvik mentioned above and caught a java.util.NoSuchElementException. I used the latest JDK8 from their site.<br /><br />Here's the code I used and commands I ran - http://pastebin.com/vVbSkBBhAnonymoushttps://www.blogger.com/profile/05146068389399014382noreply@blogger.comtag:blogger.com,1999:blog-243186646627646561.post-805174299358290202013-12-06T16:56:36.571+02:002013-12-06T16:56:36.571+02:00Cool it works. I haven't noticed wrong -jar op...Cool it works. I haven't noticed wrong -jar option. Thank you.Tomas Brandalikhttps://www.blogger.com/profile/11660715343526841288noreply@blogger.comtag:blogger.com,1999:blog-243186646627646561.post-28585048300792913662013-11-27T21:39:16.282+02:002013-11-27T21:39:16.282+02:00I've just released version 1.1.1 which gives a...I've just released version 1.1.1 which gives a proper error message in this situation (it shows the usage help if the Java agent is not loaded).Esko Luontolahttps://www.blogger.com/profile/03956946511109435404noreply@blogger.comtag:blogger.com,1999:blog-243186646627646561.post-17583343537307932412013-11-27T20:32:30.232+02:002013-11-27T20:32:30.232+02:00The "-jar" must be the last argument jus...The "-jar" must be the last argument just before the jar file.Esko Luontolahttps://www.blogger.com/profile/03956946511109435404noreply@blogger.comtag:blogger.com,1999:blog-243186646627646561.post-25971571934300693342013-11-26T17:21:50.964+02:002013-11-26T17:21:50.964+02:00Hi,
this really looks helpful, but I can't fig...Hi,<br />this really looks helpful, but I can't figure out why it doesn't work for me. Am I doing some basic mistake?<br />I'm using jdk8-b116 on linux ubuntu 12.04<br /><br />Thanks for help<br />-Tomas<br /><br />I have very simple HelloLambda class:<br /><br />package com.test.hello;<br /><br />public class HelloLambda {<br /> public static void main(String[] args) {<br /> process("This is Lambda", s -> System.out.println(s));<br /> }<br /> <br /> private static void process(String msg, Printer p) {<br /> p.out(msg);<br /> }<br /> <br /> public interface Printer {<br /> void out(T t);<br /> } <br />}<br /><br /><br />java -jar -Dretrolambda.inputDir=build/classes/main -Dretrolambda.classpath=build/classes/main -Dretrolambda.bytecodeVersion=50 -Dretrolambda.outputDir=build/libs/output -javaagent:retrolambda-1.1.0.jar retrolambda-1.1.0.jar<br /><br />and it produces exception:<br /><br />Error! Failed to transform some classes<br />java.lang.RuntimeException: java.util.NoSuchElementException<br /> at net.orfjackal.retrolambda.LambdaReifier.reifyLambdaClass(LambdaReifier.java:32)<br /> at net.orfjackal.retrolambda.LambdaUsageBackporter$InvokeDynamicInsnConvertingMethodVisitor.backportLambda(LambdaUsageBackporter.java:107)<br /> at net.orfjackal.retrolambda.LambdaUsageBackporter$InvokeDynamicInsnConvertingMethodVisitor.visitInvokeDynamicInsn(LambdaUsageBackporter.java:99)<br /> at org.objectweb.asm.ClassReader.readCode(ClassReader.java:1343)<br /> at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:938)<br /> at org.objectweb.asm.ClassReader.accept(ClassReader.java:669)<br /> at org.objectweb.asm.ClassReader.accept(ClassReader.java:506)<br /> at net.orfjackal.retrolambda.LambdaUsageBackporter.transform(LambdaUsageBackporter.java:28)<br /> at net.orfjackal.retrolambda.Main$1.transform(Main.java:40)<br /> at net.orfjackal.retrolambda.BytecodeTransformingFileVisitor.visitFile(BytecodeTransformingFileVisitor.java:25)<br /> at net.orfjackal.retrolambda.BytecodeTransformingFileVisitor.visitFile(BytecodeTransformingFileVisitor.java:11)<br /> at java.nio.file.Files.walkFileTree(Files.java:2667)<br /> at java.nio.file.Files.walkFileTree(Files.java:2739)<br /> at net.orfjackal.retrolambda.Main.main(Main.java:38)<br />Caused by: java.util.NoSuchElementException<br /> at java.util.concurrent.LinkedBlockingDeque.getFirst(LinkedBlockingDeque.java:553)<br /> at net.orfjackal.retrolambda.LambdaReifier.getLambdaFactoryMethod(LambdaReifier.java:47)<br /> at net.orfjackal.retrolambda.LambdaReifier.reifyLambdaClass(LambdaReifier.java:29)<br /> ... 13 more<br /><br />Tomas Brandalikhttps://www.blogger.com/profile/11660715343526841288noreply@blogger.comtag:blogger.com,1999:blog-243186646627646561.post-53762382335635393452013-09-05T07:25:50.222+03:002013-09-05T07:25:50.222+03:00That's a really Nice Development. Would like t...That's a really Nice Development. Would like to try it out.Anonymoushttps://www.blogger.com/profile/18378185300630463222noreply@blogger.comtag:blogger.com,1999:blog-243186646627646561.post-30598764565215051372013-07-28T00:06:29.511+03:002013-07-28T00:06:29.511+03:00I'm guessing that the performance will be the ...I'm guessing that the performance will be the same as with the original lambda expressions (or slightly better because of removing the indirection of method handles). The most probable cause of any performance difference is that the older JVMs don't do as many optimizations as the newer JVMs. So make sure to run all benchmarks using the same JVM version.Esko Luontolahttps://www.blogger.com/profile/03956946511109435404noreply@blogger.comtag:blogger.com,1999:blog-243186646627646561.post-65741975490208449542013-07-27T23:58:36.377+03:002013-07-27T23:58:36.377+03:00Nope. You're welcome to benchmark it yourselve...Nope. You're welcome to benchmark it yourselves (*insert here the usual warnings about microbenchmarks* [1]). Please write an article and post a link here.<br /><br />[1] http://stackoverflow.com/questions/504103/how-do-i-write-a-correct-micro-benchmark-in-java https://code.google.com/p/caliper/wiki/JavaMicrobenchmarksEsko Luontolahttps://www.blogger.com/profile/03956946511109435404noreply@blogger.comtag:blogger.com,1999:blog-243186646627646561.post-20378375335146847472013-07-27T20:18:40.736+03:002013-07-27T20:18:40.736+03:00Thanks Esko, my concern is with performance. Have ...Thanks Esko, my concern is with performance. Have you benchmarked it between a Java 6 and 8 VMs?dljavahttps://www.blogger.com/profile/04474135320697006217noreply@blogger.comtag:blogger.com,1999:blog-243186646627646561.post-45929678430566369372013-07-26T09:25:11.467+03:002013-07-26T09:25:11.467+03:00Cool. Im downloading JDK8 now :)Cool. Im downloading JDK8 now :)Kevin Parenthttps://www.blogger.com/profile/13963696383598897887noreply@blogger.com