Skip to content
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

Maven plugin fails to set the classpath #16

Closed
luontola opened this issue May 2, 2014 · 0 comments
Closed

Maven plugin fails to set the classpath #16

luontola opened this issue May 2, 2014 · 0 comments

Comments

@luontola
Copy link
Owner

luontola commented May 2, 2014

Without Maven plugin:

[INFO] --- maven-antrun-plugin:1.7:run (retrolambda-classes) @ jumi-core ---
[INFO] Executing tasks

main:
     [exec] Retrolambda 1.1.2
     [exec] Bytecode version: 51 (Java 7)
     [exec] Input directory:  C:\DEVEL\Jumi\jumi\jumi-core\target\classes
     [exec] Output directory: C:\DEVEL\Jumi\jumi\jumi-core\target\classes
     [exec] Classpath:        C:\DEVEL\Jumi\jumi\jumi-core\target\classes;C:\Users\ORFJackal\.m2\repository\fi\jumi\jumi-actors\0.1.196\jumi-actors-0.1.196.jar;C:\DEVEL\Jumi\jumi\jumi-api\target\jumi-api-0.5-SNAPSHOT.jar;C:\Users\ORFJackal\.m2\repository\junit\junit\4.11\junit-4.11.jar;C:\Users\ORFJackal\.m2\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;C:\Users\ORFJackal\.m2\repository\io\netty\netty\3.5.5.Final\netty-3.5.5.Final.jar;C:\Users\ORFJackal\.m2\repository\commons-io\commons-io\2.4\commons-io-2.4.jar;C:\Users\ORFJackal\.m2\repository\org\apache\commons\commons-lang3\3.1\commons-lang3-3.1.jar;C:\Users\ORFJackal\.m2\repository\cglib\cglib-nodep\2.2.2\cglib-nodep-2.2.2.jar;C:\Users\ORFJackal\.m2\repository\com\google\code\findbugs\jsr305\2.0.1\jsr305-2.0.1.jar
     [exec] Saving lambda class: fi/jumi/core/ipc/buffer/MappedByteBufferSequence$$Lambda$1
     [exec] Saving lambda class: fi/jumi/core/network/NettyNetworkClient$$Lambda$1
     [exec] Saving lambda class: fi/jumi/core/network/NettyNetworkServer$$Lambda$1
     [exec] Saving lambda class: fi/jumi/core/util/timeout/InitialMessageTimeout$$Lambda$1
[INFO] Executed tasks

With Maven plugin:

[INFO] --- retrolambda-maven-plugin:1.2.0:process-main (default) @ jumi-core ---
[INFO] Retrieving the Retrolambda JAR
[INFO] Configured Artifact: net.orfjackal.retrolambda:retrolambda:1.2.0:jar
[INFO] Copying retrolambda-1.2.0.jar to C:\DEVEL\Jumi\jumi\jumi-core\target\retrolambda.jar
[INFO] Processing classes with Retrolambda
[INFO] Executing tasks

main:
     [exec] Retrolambda 1.2.0
     [exec] Bytecode version: 51 (Java 7)
     [exec] Input directory:  C:\DEVEL\Jumi\jumi\jumi-core\target\classes
     [exec] Output directory: C:\DEVEL\Jumi\jumi\jumi-core\target\classes
     [exec] Classpath:        C:\DEVEL\Jumi\jumi\jumi-core\target\classes
     [exec] WARNING: Method '<clinit>' of interface 'fi/jumi/core/drivers/DriverFinder' is non-abstract! This will probably fail to run on Java 7 and below. If you get this warning _without_ using Java 8's default methods, please report a bug at https://github.com/orfjackal/retrolambda/issues together with an SSCCE (http://www.sscce.org/)
     [exec] Saving lambda class: fi/jumi/core/ipc/buffer/MappedByteBufferSequence$$Lambda$1
     [exec] Error! Failed to transform some classes
     [exec] java.lang.RuntimeException: java.lang.TypeNotPresentException: Type org.jboss.netty.channel.ChannelPipelineFactory not present
     [exec]     at net.orfjackal.retrolambda.LambdaReifier.reifyLambdaClass(LambdaReifier.java:34)
     [exec]     at net.orfjackal.retrolambda.LambdaUsageBackporter$InvokeDynamicInsnConvertingMethodVisitor.backportLambda(LambdaUsageBackporter.java:110)
     [exec]     at net.orfjackal.retrolambda.LambdaUsageBackporter$InvokeDynamicInsnConvertingMethodVisitor.visitInvokeDynamicInsn(LambdaUsageBackporter.java:102)
     [exec]     at org.objectweb.asm.ClassReader.readCode(ClassReader.java:1438)
     [exec]     at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1017)
     [exec]     at org.objectweb.asm.ClassReader.accept(ClassReader.java:693)
     [exec]     at org.objectweb.asm.ClassReader.accept(ClassReader.java:506)
     [exec]     at net.orfjackal.retrolambda.LambdaUsageBackporter.transform(LambdaUsageBackporter.java:19)
     [exec]     at net.orfjackal.retrolambda.Main$1.transform(Main.java:40)
     [exec]     at net.orfjackal.retrolambda.BytecodeTransformingFileVisitor.visitFile(BytecodeTransformingFileVisitor.java:25)
     [exec]     at net.orfjackal.retrolambda.BytecodeTransformingFileVisitor.visitFile(BytecodeTransformingFileVisitor.java:11)
     [exec]     at java.nio.file.Files.walkFileTree(Files.java:2667)
     [exec]     at java.nio.file.Files.walkFileTree(Files.java:2739)
     [exec]     at net.orfjackal.retrolambda.Main.main(Main.java:38)
     [exec] Caused by: java.lang.TypeNotPresentException: Type org.jboss.netty.channel.ChannelPipelineFactory not present
     [exec]     at sun.invoke.util.BytecodeDescriptor.parseSig(BytecodeDescriptor.java:85)
     [exec]     at sun.invoke.util.BytecodeDescriptor.parseMethod(BytecodeDescriptor.java:63)
     [exec]     at sun.invoke.util.BytecodeDescriptor.parseMethod(BytecodeDescriptor.java:41)
     [exec]     at java.lang.invoke.MethodType.fromMethodDescriptorString(MethodType.java:911)
     [exec]     at net.orfjackal.retrolambda.LambdaReifier.toMethodType(LambdaReifier.java:98)
     [exec]     at net.orfjackal.retrolambda.LambdaReifier.callBootstrapMethod(LambdaReifier.java:72)
     [exec]     at net.orfjackal.retrolambda.LambdaReifier.reifyLambdaClass(LambdaReifier.java:30)
     [exec]     ... 13 more
     [exec] Caused by: java.lang.ClassNotFoundException: org.jboss.netty.channel.ChannelPipelineFactory
     [exec]     at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
     [exec]     at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
     [exec]     at java.security.AccessController.doPrivileged(Native Method)
     [exec]     at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
     [exec]     at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
     [exec]     at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
     [exec]     at sun.invoke.util.BytecodeDescriptor.parseSig(BytecodeDescriptor.java:83)
     [exec]     ... 19 more
Arneball added a commit to Arneball/retrolambda that referenced this issue Aug 11, 2014
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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant