Juergen Hoeller opened SPR-15859 and commented
As discussed in cglib/cglib@d6fe1d8 and in #20245 comments, there is currently a defineClass warning triggered by CGLIB when running on JDK 9 in classpath mode. While there are workarounds for it ("illegal-access=deny" or "add-opens java.base/java.lang=ALL-UNNAMED"), suppressing that warning at runtime, it'd be nice to avoid the warning completely when running on JDK 9, possibly through a specific check for JDK 9 which skips the ClassLoader.defineClass access attempt completely, always going with the Unsafe.defineClass fallback right away in such a scenario. We have yet to see whether this can be patched in CGLIB itself or just in Spring's CGLIB fork.
UPDATE: Since JDK 11 won't have Unsafe.defineClass at all anymore, we need to use MethodHandles.Lookup.defineClass as our primary mechanism, avoiding a ClassLoader.defineClass warning on the classpath and providing compatibility with the module path on JDK 11.
Affects: 5.0 RC3
Reference URL: cglib/cglib@d6fe1d8
Issue Links:
Referenced from: commits 6a34ca2, 61c3db0
17 votes, 40 watchers
Juergen Hoeller opened SPR-15859 and commented
As discussed in cglib/cglib@d6fe1d8 and in #20245 comments, there is currently a
defineClasswarning triggered by CGLIB when running on JDK 9 in classpath mode. While there are workarounds for it ("illegal-access=deny" or "add-opens java.base/java.lang=ALL-UNNAMED"), suppressing that warning at runtime, it'd be nice to avoid the warning completely when running on JDK 9, possibly through a specific check for JDK 9 which skips theClassLoader.defineClassaccess attempt completely, always going with theUnsafe.defineClassfallback right away in such a scenario. We have yet to see whether this can be patched in CGLIB itself or just in Spring's CGLIB fork.UPDATE: Since JDK 11 won't have
Unsafe.defineClassat all anymore, we need to useMethodHandles.Lookup.defineClassas our primary mechanism, avoiding aClassLoader.defineClasswarning on the classpath and providing compatibility with the module path on JDK 11.Affects: 5.0 RC3
Reference URL: cglib/cglib@d6fe1d8
Issue Links:
@Configurationusing Java 9 prints ugly illegal access warnings ("is duplicated by")Referenced from: commits 6a34ca2, 61c3db0
17 votes, 40 watchers