Skip to content

Can not populate default methods, when interfaces are in classpath and not in input directory #98

Description

@teras

Let's have an interface in a stand alone project. The compiled classes can be found (let's say) under target/lib . The source is as follows:

package test;

public interface AnInterface {

    public void one();

    public default void two() {
    }
}

Then, let's assume that we have another class, where the compiled classes could be found under target/classes, and the code is as follows:

package test;

public class Main implements AnInterface {

    public static void main(String[] args) {
        Main main = new Main();
        main.one();
        main.two();
    }

    @Override
    public void one() {
    }
}

If we execute retrolambda like this, java -Dretrolambda.inputDir=target/classes -Dretrolambda.classpath=target/classes:target/lib -Dretrolambda.defaultMethods=true -jar retrolambda-2.3.0.jar then javap produces the next output:

Compiled from "Main.java"
public class test.Main implements test.AnInterface {
  public test.Main();
  public static void main(java.lang.String[]);
  public void one();
}

If I move the interface to the inputdir folder, then I get this output:

Compiled from "Main.java"
public class test.Main implements test.AnInterface {
  public test.Main();
  public static void main(java.lang.String[]);
  public void one();
  public void two();
}

I would expect that, no matter where the interface is, the "produced" Main class to have the missing method injected, as well as the produced test/AnInterface$.class to appear in the output folder. But this is not the case.

Am I missing something?
Is this a feature request?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions