Community
Participate
Working Groups
The aspectjtools & aspectjweaver jars of version 1.9.4 are making use of jdk.unsupported module’s class sun.misc.UnSafe which makes use of JDK Internal APIs. http://openjdk.java.net/jeps/260 states that use of non-standard, unstable, and unsupported APIs that are internal implementation details of the JDK were never intended for external use. This JEP does not commit to preserve the compatibility of any internal APIs across releases; they continue to remain unstable and subject to change without notice. We are migrating our product to Java 11 & this would lead us into a unstable situation, further there can be a blocker if the internal APIs are removed without notice. Hence, To avoid the above situation an alternative needs to be find for the usage of sun.misc.UnSafe in those 2 jars(aspectjtools & aspectjweaver). Jar Name ClassName Issue aspectjtools.jar org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor sun.misc.Unsafe (JDK internal API (jdk.unsupported)) aspectjweaver.jar org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor sun.misc.Unsafe (JDK internal API (jdk.unsupported))
#Addind a well formatted issue# Jar Name ClassName Issue aspectjtools.jar org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor sun.misc.Unsafe (JDK internal API (jdk.unsupported)) aspectjweaver.jar org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor sun.misc.Unsafe (JDK internal API (jdk.unsupported))
I have planned to review the situation for 1.9.5.
Right, paging this back into my brain. I've actually already done the work to avoid using Unsafe on Java11. It looks like you are using a jar scanner rather than running code against the weaver? Inside CLWA there are different codepaths depending on the JDK level: if (LangUtil.is11VMOrGreater()) { if (!initializedForJava11) { initializeForJava11(); } // Do this: clazz = defineClassMethodHandle.bindTo(loader).invokeWithArguments(name, bytes, 0, bytes.length, protectionDomain); Object o = bindTo_Method.invoke(defineClassMethodHandle,loader); clazz = invokeWithArguments_Method.invoke(o, new Object[] {new Object[] {name, bytes, 0, bytes.length, protectionDomain}}); } else { if (defineClassMethod == null) { synchronized (lock) { getUnsafe(); defineClassMethod = Unsafe.class.getDeclaredMethod("defineClass", String.class,byte[].class,Integer.TYPE,Integer.TYPE, ClassLoader.class,ProtectionDomain.class); } } defineClassMethod.setAccessible(true); clazz = defineClassMethod.invoke(getUnsafe(), name,bytes,0,bytes.length,loader,protectionDomain); } So unsafe is only used below Java11. Now on Java11 you do a slight nasty that I want to try and address, and the problem/workaround is covered in bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=546305 - but that is not as bad I would say. If you are seeing Unsafe related problems when running on AspectJ with Java11, let me know.