Description
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:
- Compatibility with JDK 11 [SPR-16391] #20937 Compatibility with JDK 11 ("is depended on by")
- An illegal reflective access operation has occurred [SPR-16777] #21317 An illegal reflective access operation has occurred ("duplicates")
- Running an app with @Configuration using Java 9 prints ugly illegal access warnings [SPR-15939] #20493 Running an app with
@Configuration
using Java 9 prints ugly illegal access warnings ("is duplicated by") - ReflectUtils produces Warning in Spring Boot 2.0.0.M6 and Java 9.0.1 [SPR-16236] #20783 ReflectUtils produces Warning in Spring Boot 2.0.0.M6 and Java 9.0.1 ("is duplicated by")
- Upgrade to CGLIB 3.2.5 [SPR-15147] #19713 Upgrade to CGLIB 3.2.5
- DATACMNS-1376 Assure JDK 11 compatibility for DefaultMethodInvokingMethodInterceptor
- i'm new with spring and from the start i found this warning while executing [SPR-17380] #21913 i'm new with spring and from the start i found this warning while executing
- Spring Boot DevTools on 5.1 fails with java.lang.LinkageError: loader attempted duplicate class definition [SPR-16902] #21441 Spring Boot DevTools on 5.1 fails with java.lang.LinkageError: loader attempted duplicate class definition
- Illegal reflective access operation warning for toString() on CGLIB proxies [SPR-17500] #22032 Illegal reflective access operation warning for toString() on CGLIB proxies
- DATACMNS-1401 Warning about illegal reflective access in Spring Data Commons / MongoDB
Referenced from: commits 6a34ca2, 61c3db0
17 votes, 40 watchers