-
Notifications
You must be signed in to change notification settings - Fork 226
Description
Preconditions:
- Multi-module Maven build with retrolambda in multiple modules.
- retrolambda-maven-plugin with fork=false
- JDK 8, tested with various versions, my most recent test used Oracle JDK 1.8.0_281-b09.
If java.lang.invoke.InnerClassLambdaMetafactory is JIT'd, the static final reference to dumper will be inlined in a PrivilegedAction anonymous class (at least that's my guess given the observed behaviour) and remain unchanged even when later retrolambda executions change the dumper variable with reflection. The relevant JDK code is the following:
In practice, that means that once that class is JIT'd, for example, after processing 1000 lambdas, further executions of retrolambda will write .class files to the output directory of the previous module.
Here's a repository to reproduce the problem: https://github.com/smola/retrolambda-jit-bug
In short: run ./repro.sh and you should see .class files from module2 written to module1/target/classes.
Workarounds:
- Use fork=true
- Use interpreter execution only (very slow):
MAVEN_OPTS="-Xint" ./repro.sh