-
Notifications
You must be signed in to change notification settings - Fork 37
Fix the illegal lookupClass
issue when using MethodHandles.Lookup
on JDK 8
#594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
b0fdd16
to
c880d09
Compare
@zhelenskiy, please update the PR title and description to indicate what this PR fixes. |
@zhelenskiy, please also add an integration test for the issue. |
c880d09
to
12b598d
Compare
The integration test for this issue is considered too complex, so we decided not to include it, as it would require too much effort. It would be possible to include the whole Kotlin project once it would start working completely fine. |
lookupClass
issue when using MethodHandles.Lookup
on JDK 8
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/ManagedStrategy.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/transformation/LincheckClassVisitor.kt
Outdated
Show resolved
Hide resolved
395ed1c
to
ba589f3
Compare
ba589f3
to
6cb9742
Compare
The issue was caused by the fact that
MethodHandles.lookup
, needed for custom handling of invoke-dynamic cannot be called from certain locations. In the case of Java > 8, the only limitation isjava.lang.invoke
, which is fine. While in Java 8 it also includes all Java stdlib packages. So the workaround was to call a private constructor ofMethodHandles
privately with reflection.The issue was reproducible on one of the tests from Kotlin compiler repository.