Summary: | aspectjtools.jar & aspectjweaver.jar - internal API usage in Java 11 | ||
---|---|---|---|
Product: | [Tools] AspectJ | Reporter: | Rohit Gaikwad <rohitgaikwad0907> |
Component: | Library | Assignee: | aspectj inbox <aspectj-inbox> |
Status: | NEW --- | QA Contact: | |
Severity: | critical | ||
Priority: | P3 | CC: | aclement |
Version: | 1.9.4 | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Windows 10 | ||
Whiteboard: |
Description
Rohit Gaikwad
2019-11-12 07:03:14 EST
#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. |