Make Java agent work with JDK 9+#148
Merged
luontola merged 1 commit intoluontola:masterfrom Nov 30, 2018
dmitri-gb:master
Merged
Make Java agent work with JDK 9+#148luontola merged 1 commit intoluontola:masterfrom dmitri-gb:master
luontola merged 1 commit intoluontola:masterfrom
dmitri-gb:master
Conversation
Starting with JDK 9, class file transformers are not invoked for generated lambda classes anymore [1]. This commit makes Retrolambda patch JDK's InnerClassLambdaMetafactory instead, getting the bytes directly from its spinInnerClass method. This way, one can run Retrolambda with both Java 8 as well as Java 11 (input classes must still be compiled to Java 8 of course). [1] http://mail.openjdk.java.net/pipermail/core-libs-dev/2016-January/038199.html
Owner
|
Thanks for the PR. Instead of the |
Owner
|
This has been included in Retrolambda 2.5.6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi!
I would like to propose an alternative strategy for getting the lambda class bytes. Starting with JDK 9, class file transformers are not invoked for generated lambda classes anymore [1], which is the reason Retrolambda currently fails when run with Java 11 with the
-javaagentoption. This PR makes Retrolambda patch JDK'sInnerClassLambdaMetafactoryinstead, getting the bytes directly from itsspinInnerClassmethod. This way, one can run Retrolambda with both Java 8 as well as Java 11 (input classes must still be compiled to Java 8 of course).The primary motivation for this change was to be able to run a Maven build with Java 11 (with
--release 8or-source 8 -target 8) and have the Retrolambda Maven plugin transform the classes to Java 6 bytecode, without needing to also have JDK 8 available and passing its path in the<java8home>plugin configuration option.[1] http://mail.openjdk.java.net/pipermail/core-libs-dev/2016-January/038199.html