question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Java 9 question & issue

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
luontolacommented, Sep 22, 2017

Hmm, now that I look at the stack trace more closely, it’s coming from Retrolambda’s code (it’s the commandline parsing which happens before your code is even loaded). Please create a new issue. Preferrably with a sample project for reproducing the issue (http://sscce.org/).

0reactions
MastaPcommented, Sep 22, 2017

Fails with [ERROR] Failed to execute goal net.orfjackal.retrolambda:retrolambda-maven-plugin:2.5.1:process-main (default) on project xhub-mappings: Unable to execute mojo: An Ant BuildException has occured: exec returned: 1 [ERROR] around Ant part ...<exec failonerror="true" executable="/Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/bin/java">... @ 4:115 in /Users/pavelg/zt/pacman/xhub-agent/xhub-mappings/target/antrun/build-main.xml [ERROR] -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal net.orfjackal.retrolambda:retrolambda-maven-plugin:2.5.1:process-main (default) on project xhub-mappings: Unable to execute mojo at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212) ... Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to execute mojo at org.twdata.maven.mojoexecutor.MojoExecutor.executeMojo(MojoExecutor.java:96) at net.orfjackal.retrolambda.maven.ProcessClassesMojo.processClassesInForkedProcess(ProcessClassesMojo.java:158) at net.orfjackal.retrolambda.maven.ProcessClassesMojo.execute(ProcessClassesMojo.java:112) at net.orfjackal.retrolambda.maven.ProcessMainClassesMojo.execute(ProcessMainClassesMojo.java:17) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)

also, specifying java8home on all environments is not convenient. I’ll try to come up with SSCCE later, if still needed

Read more comments on GitHub >

github_iconTop Results From Across the Web

Java 9 - Interview Questions - Tutorialspoint
What are the main goals of Java 9 release? · Name some of significant changes in Java 9. · What is module in...
Read more >
New in Java 9 Interview Questions and Answers - InterviewGrid
Java - Interview Questions · What are the key features and enhancements introduced in Java 9? · Describe the Java platform module system...
Read more >
Interview Questions and Answers for 'Java 9'
1. Will make applications lighter as only required modules will be built with the application. Moreover there are some legacy packages currently which...
Read more >
Java 9+ modularity: The difficulties and pitfalls of migrating ...
In Java 9, all programs are compiled and executed using the module system and the language strongly encapsulates types that are not exported...
Read more >
'Java 9, it did break some things,' Oracle bod admits to devs ...
Java has a problem – the language and platform is evolving faster than ever, but many developers are stuck on the five-year-old Java...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found