Skip to content
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

JDK9 Reference To Internal APIs #14

Open
ghost opened this issue Mar 31, 2017 · 3 comments
Open

JDK9 Reference To Internal APIs #14

ghost opened this issue Mar 31, 2017 · 3 comments

Comments

@ghost
Copy link

ghost commented Mar 31, 2017

When running with Jigsaw b162 or later with --permit-illegal-access, the following warnings are generated.
This is due to use of setAccessible to break into JDK classes.

WARNING: Illegal access by org.jboss.classfilewriter.ClassFile$1 (file:/modules/org.jboss.classfilewriter.jboss-classfilewriter.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int)
WARNING: Illegal access by org.jboss.classfilewriter.ClassFile$1 (file:/modules/org.jboss.classfilewriter.jboss-classfilewriter.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)

@manovotn
Copy link
Contributor

Similar problem as in WELD-2367. So far it seems that for JDK 9 the only viable way is to use Unsafe.defineClass.

Similar problem described here (cglib) - cglib/cglib#93
Commit resolving this issue in JDK 9 - cglib/cglib@d6fe1d8

For some reason, Unsafe is an exception in JDK 9 and you can call setAccessible there.

@ghost
Copy link
Author

ghost commented Aug 6, 2018

Unsafe.defineClass went away in JDK11.
The only approach is Classloader.defineClass.

@manovotn
Copy link
Contributor

manovotn commented Aug 6, 2018

This is no longer a problem and should be closed, see #16.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant