FULL PRODUCT VERSION :
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)
FULL OS VERSION :
Darwin mybox 14.5.0 Darwin Kernel Version 14.5.0: Wed Jul 29 02:26:53 PDT 2015; root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64
A DESCRIPTION OF THE PROBLEM :
In attempting to transform a lambda instance, it appears the application class loader has no knowledge of its existence. Presumably, this is due to the lambda instance representation being generated at runtime.
As a consequence, this causes a handful of instrumentation issues. For instance, simply passing a lambda instance through a class transformer and returning a null set of bytes to indicate 'do not transform', fails outright with a NoClassDefFoundError. In other cases, if in using instrumentation tools like ASM compute stack map frames for type checking; the composed stack map can be bogus as the 'type' doesn't really exist.
I've noted the behavior on Stackoverflow to get a feel of whether or not this may be a JDK bug. Please see the following entry here: http://stackoverflow.com/questions/34162074/transforming-lambdas-in-java-8
Additionally, I've created a simple repro for the issue in Github: https://github.com/akilman/java-lambda-retransform
THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Did not try
THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Did not try
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Please see https://github.com/akilman/java-lambda-retransform for source code. This is a set of two simple gradle projects for reproducing the issue.
Assuming the environment has access to the web, clone the github repo, and execute run.sh. This will build and run both projects via Gradle.
EXPECTED VERSUS ACTUAL BEHAVIOR :
Expectation is, transforming lambdas should be fair game. The instrumentation API doesn't exclude this category, so one would assume the two categories of functionality should work together.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.NoClassDefFoundError: App$$Lambda$2
at App$$Lambda$2/1329552164.run(Unknown Source)
at App.main(App.java:9)
Caused by: java.lang.ClassNotFoundException: App$$Lambda$2
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 2 more
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
Please see https://github.com/akilman/java-lambda-retransform for source code.
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
No workaround at the moment
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)
FULL OS VERSION :
Darwin mybox 14.5.0 Darwin Kernel Version 14.5.0: Wed Jul 29 02:26:53 PDT 2015; root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64
A DESCRIPTION OF THE PROBLEM :
In attempting to transform a lambda instance, it appears the application class loader has no knowledge of its existence. Presumably, this is due to the lambda instance representation being generated at runtime.
As a consequence, this causes a handful of instrumentation issues. For instance, simply passing a lambda instance through a class transformer and returning a null set of bytes to indicate 'do not transform', fails outright with a NoClassDefFoundError. In other cases, if in using instrumentation tools like ASM compute stack map frames for type checking; the composed stack map can be bogus as the 'type' doesn't really exist.
I've noted the behavior on Stackoverflow to get a feel of whether or not this may be a JDK bug. Please see the following entry here: http://stackoverflow.com/questions/34162074/transforming-lambdas-in-java-8
Additionally, I've created a simple repro for the issue in Github: https://github.com/akilman/java-lambda-retransform
THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Did not try
THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Did not try
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Please see https://github.com/akilman/java-lambda-retransform for source code. This is a set of two simple gradle projects for reproducing the issue.
Assuming the environment has access to the web, clone the github repo, and execute run.sh. This will build and run both projects via Gradle.
EXPECTED VERSUS ACTUAL BEHAVIOR :
Expectation is, transforming lambdas should be fair game. The instrumentation API doesn't exclude this category, so one would assume the two categories of functionality should work together.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.NoClassDefFoundError: App$$Lambda$2
at App$$Lambda$2/1329552164.run(Unknown Source)
at App.main(App.java:9)
Caused by: java.lang.ClassNotFoundException: App$$Lambda$2
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 2 more
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
Please see https://github.com/akilman/java-lambda-retransform for source code.
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
No workaround at the moment
- duplicates
-
JDK-8158475 JVMTI RedefineClasses doesn't handle anonymous classes properly
-
- Closed
-
-
JDK-8169459 Retransformation of lambdas causes verifier errors and no class def found errors
-
- Closed
-