Community
Participate
Working Groups
Created attachment 275334 [details] Java 9+ compliancy Hello, Weaving a jar file using AspectJ v1.9.1, under Java 9 and 10, generates the following code: import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.aspectj.lang.NoAspectBoundException; import org.aspectj.lang.annotation.AfterReturning; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Pointcut; import org.aspectj.runtime.internal.CFlowStack; ... @Aspect public class MyClass { private static final Log A_LOG; private static /* synthetic */ Throwable ajc$initFailureCause; public static /* synthetic */ MyClass ajc$perSingletonInstance; public static final /* synthetic */ CFlowStack ajc$cflowStack$0; static { MyClass.ajc$preClinit(); try { A_LOG = LogFactory.getLog(MyClass.class); MyClass.ajc$postClinit(); } catch (Throwable throwable) { ajc$initFailureCause = throwable; } } ... public static boolean hasAspect() { if (ajc$perSingletonInstance != null) { return true; } return false; } private static /* synthetic */ void ajc$postClinit() { ajc$perSingletonInstance = new MyClass(); } private static /* synthetic */ void ajc$preClinit() { ajc$cflowStack$0 = new CFlowStack(); } } The execution of this code, under Java 9 and 10, generates the following execption: java.util.concurrent.ExecutionException: java.lang.IllegalAccessError: Update to static final field MyClass.ajc$cflowStack$0 attempted from a different method (ajc$preClinit) than the initializer method <clinit> ... Caused by: java.lang.IllegalAccessError: Update to static final field MyClass.ajc$cflowStack$0 attempted from a different method (ajc$preClinit) than the initializer method <clinit> at MyClass.ajc$preClinit(MyClass.aj:1) ~[myjar-aop.jar:w.x.y-z] at MyClass.<clinit>(MyClass.aj) ~[myjar-aop.jar:w.x.y-z] ... 1 more I have successfully tried to patch the sources of AspectJ so that I can move forward in my work. For your information, I added my patch attachment. Could you please take a look at this problem so that AspectJ complies with the specifications of Java 9 and above, concerning the initialization of the "static final" class attributes? Thanks in advance.
All fixed up! Should have been caught when fixing this situation for the joinpoint objects, same fix here. Thanks for catching it. I guess will become a real issue when folks move from between LTS versions (8>11).