-
Notifications
You must be signed in to change notification settings - Fork 226
Created retrolambda maven plugin. see issue #14 #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…nter 1.5,1.6,1.7, 1.8 which is a bit more obvious for most users. Fixed javadoc that only made reference to converting to java 7 bytecode
|
Thanks a lot! I'll review and merge the code in a few days when I have enough time to do it. |
|
Great stuff. I've just released version 1.2.0 which includes this plugin. |
|
The plugin had issue #16. Something like to the antrun plugin not being executed in the context of the actual module, and thus not seeing its classpath. It might anyways be better to ask Maven APIs directly for the classpath, because the antrun classpath thing is a hack. I'll have a look at it tomorrow. |
|
Hmm. I'll have a look too sometime today if kids allow..
|
|
One way to fix would be to copy deps using the dependency plugin to the
|
|
Got it fixed: 919bc69 I've released 1.2.1 which should now work properly. |
|
very nice fix |
public interface MyInterface {
default String def() {
return "[" + toString() + ", " + "def]";
}
default String join(MyInterface other) {
return def() + other.def();
}
}
class C implements MyInterface{} compiles to:
public class testpackage.MyClass implements testpackage.MyInterface {
public testpackage.MyClass();
Code:
0: aload_0
1: invokespecial luontola#16 // Method java/lang/Object."<init>":()V
4: return
public java.lang.String join(testpackage.MyInterface);
Code:
0: aload_0
1: aload_1
2: invokestatic luontola#46 // Method testpackage/MyInterfacehelper.join:(Ltestpackage/MyInterface;Ltestpackage/MyInterface;)Ljava/lang/String;
5: areturn
public java.lang.String def();
Code:
0: aload_0
1: invokestatic luontola#49 // Method testpackage/MyInterfacehelper.def:(Ltestpackage/MyInterface;)Ljava/lang/String;
4: areturn
}
Where testpackage.MyInterfacehelper is compiled to
public class testpackage.MyInterfacehelper {
private testpackage.MyInterfacehelper();
Code:
0: aload_0
1: invokespecial luontola#9 // Method java/lang/Object."<init>":()V
4: return
public static java.lang.String def(testpackage.MyInterface);
Code:
0: new luontola#13 // class java/lang/StringBuilder
3: dup
4: invokespecial luontola#14 // Method java/lang/StringBuilder."<init>":()V
7: ldc luontola#16 // String [
9: invokevirtual luontola#20 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
12: aload_0
13: invokevirtual luontola#24 // Method java/lang/Object.toString:()Ljava/lang/String;
16: invokevirtual luontola#20 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
19: ldc luontola#26 // String ,
21: invokevirtual luontola#20 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
24: ldc luontola#28 // String def]
26: invokevirtual luontola#20 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
29: invokevirtual luontola#29 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
32: areturn
public static java.lang.String join(testpackage.MyInterface, testpackage.MyInterface);
Code:
0: new luontola#13 // class java/lang/StringBuilder
3: dup
4: invokespecial luontola#14 // Method java/lang/StringBuilder."<init>":()V
7: aload_0
8: invokeinterface luontola#35, 1 // InterfaceMethod testpackage/MyInterface.def:()Ljava/lang/String;
13: invokevirtual luontola#20 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
16: aload_1
17: invokeinterface luontola#35, 1 // InterfaceMethod testpackage/MyInterface.def:()Ljava/lang/String;
22: invokevirtual luontola#20 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
25: invokevirtual luontola#29 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
28: areturn
}
==============
interface StaticTest {
static <T> T staticMethod(T t) {
return t;
}
}
compiles to
public class testpackage.StaticTesthelper {
private testpackage.StaticTesthelper();
Code:
0: aload_0
1: invokespecial luontola#9 // Method java/lang/Object."<init>":()V
4: return
public static <T> T staticMethod$static(T);
Code:
0: aload_0
1: areturn
}
========
Brigde methods are generated properly in example:
public interface BridgeParent<T> {
T get();
}
public interface StringBridges extends BridgeParent<String> {
@OverRide
default String get() {
return "default method";
}
default String concrete() {
return "concrete";
}
}
public class testpackage.StringBridgeshelper
SourceFile: "testpackage/StringBridges.java"
minor version: 0
major version: 50
flags: ACC_PUBLIC, ACC_SUPER
Constant pool:
luontola#1 = Utf8 testpackage/StringBridgeshelper
luontola#2 = Class luontola#1 // testpackage/StringBridgeshelper
luontola#3 = Utf8 java/lang/Object
luontola#4 = Class luontola#3 // java/lang/Object
luontola#5 = Utf8 testpackage/StringBridges.java
luontola#6 = Utf8 <init>
luontola#7 = Utf8 ()V
luontola#8 = NameAndType luontola#6:luontola#7 // "<init>":()V
luontola#9 = Methodref luontola#4.luontola#8 // java/lang/Object."<init>":()V
luontola#10 = Utf8 get
luontola#11 = Utf8 (Ltestpackage/StringBridges;)Ljava/lang/String;
luontola#12 = Utf8 default method
luontola#13 = String luontola#12 // default method
luontola#14 = Utf8 concrete
luontola#15 = String luontola#14 // concrete
luontola#16 = Utf8 (Ltestpackage/StringBridges;)Ljava/lang/Object;
luontola#17 = Utf8 testpackage/StringBridges
luontola#18 = Class luontola#17 // testpackage/StringBridges
luontola#19 = Utf8 ()Ljava/lang/String;
luontola#20 = NameAndType luontola#10:luontola#19 // get:()Ljava/lang/String;
luontola#21 = InterfaceMethodref luontola#18.luontola#20 // testpackage/StringBridges.get:()Ljava/lang/String;
luontola#22 = Utf8 Code
luontola#23 = Utf8 LineNumberTable
luontola#24 = Utf8 SourceFile
{
private testpackage.StringBridgeshelper();
descriptor: ()V
flags: ACC_PRIVATE
Code:
stack=1, locals=1, args_size=1
0: aload_0
1: invokespecial luontola#9 // Method java/lang/Object."<init>":()V
4: return
public static java.lang.String get(testpackage.StringBridges);
descriptor: (Ltestpackage/StringBridges;)Ljava/lang/String;
flags: ACC_PUBLIC, ACC_STATIC
Code:
stack=1, locals=1, args_size=1
0: ldc luontola#13 // String default method
2: areturn
LineNumberTable:
line 9: 0
public static java.lang.String concrete(testpackage.StringBridges);
descriptor: (Ltestpackage/StringBridges;)Ljava/lang/String;
flags: ACC_PUBLIC, ACC_STATIC
Code:
stack=1, locals=1, args_size=1
0: ldc luontola#15 // String concrete
2: areturn
LineNumberTable:
line 13: 0
public static java.lang.Object get(testpackage.StringBridges);
descriptor: (Ltestpackage/StringBridges;)Ljava/lang/Object;
flags: ACC_PUBLIC, ACC_STATIC, ACC_BRIDGE, ACC_SYNTHETIC
Code:
stack=1, locals=1, args_size=1
0: aload_0
1: invokeinterface luontola#21, 1 // InterfaceMethod testpackage/StringBridges.get:()Ljava/lang/String;
6: areturn
LineNumberTable:
line 6: 0
}
Hi, I created retrolambda-maven-plugin and it is now used in end-to-end-tests. Please review and merge if happy.
Seems to work ok and passes all tests.
I left the dependency plugin and ant plugin combo commented out in end-to-end-tests/pom.xml for reference but I reckon it should be removed once you think the plugin covers the necessary use cases.
I've updated README.md but outstanding is still to put the plugin documentation somewhere. Running mvn clean site in retrolambda-maven-plugin generates the documentation for the plugin in target/site. I put stuff like that in a script like this so I can update it easily. You'd have to setup the orfjackal.github.io repo to facilitate that. GitHub doco tells you how if you haven't got one already.
Cheers
Dave