Skip to content

Java 9 question & issue #119

@csoroiu

Description

@csoroiu

Are there any plans to support java 9, meaning that the generated bytecode should be compatible with java 9, right?

I'm asking this because I encountered an interesting issue:

I have a project lambdamatchers which has some lambdas based on Stream class, which I agree they are not supposed to work on Java < 8.

I run retrolambda on the classes and after I run unit tests using Java 8, it works fine with the code created by retrolambda (using as a target 1.5, 1.6, 1.7 and even 1.8), but when running the unit tests using Java 9 i get the IncompatibleClassChangeError:

java.lang.IncompatibleClassChangeError: Method java.util.stream.Stream.of([Ljava/lang/Object;)Ljava/util/stream/Stream; must be InterfaceMethodref constant
    at ro.derbederos.hamcrest.StreamTest.streamOf(StreamTest.java:32)
...

This can be easily reproduced with:

public class StreamTest {
    @Test
    public void streamIsEmpty() {
        Stream.empty();
    }
}

Stream::empty is a static interface method, maybe the way they are invoked is the issue.

Also, running unit tests with Java 9 without retrolambda-ing the project does not reproduce the issue.
I'm not 100% sure, but this might to be an issue with the jvm.

Note: This is not a real issue, I observed it during some tests, but I can work around it, as only the test code had issues, but I wanted to bring it into attention. Hopefully this does not cause problems for anybody. The test code in my case can be read as "the client code" and the client should not use retrolambda if the target is Java >= 8.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions