Community
Participate
Working Groups
Created attachment 261287 [details] crash log Compilation flow of this bug is: 1. compiled all aspects in project on 'main' configuration; 2. then starts compilation of 'test' config, where already compiled aspects and java classes passed as '-aspectpath' and '-classpath'; 3. failed with ajc crash; The aspect where ajc fails: aspect OptionMenuRules { private static final String TAG = OptionMenuRules.class.getSimpleName(); declare warning : illegalNativeCall() : "Call to ::setHasOptionsMenu(boolean) is forbidden! Call was obsolete. Remove this call from your source!"; declare warning : missedActionBar() : "Do not attch ActionBar to Activity from current Fragment!"; pointcut illegalNativeCall(): findOptionsMenuDecor() && within(Fragment+) && call(void *.setHasOptionsMenu(boolean)); pointcut missedActionBar(): findOptionsMenuDecor() && call(void AppCompatActivity+.setSupportActionBar(..)); private pointcut findOptionsMenuDecor(): !staticinitialization(*) && @annotation(WithOptionsMenu); private pointcut excludeNativeOptionsSetter(WithOptionsMenu menu): @this(menu) && (within(Fragment+) || within(AppCompatActivity+)) && cflow(execution(void *.onCreate(..))) && call(void *.setHasOptionsMenu(boolean)); void around(WithOptionsMenu menuMark): excludeNativeOptionsSetter(menuMark) { Class<?> target = thisJoinPoint.getThis().getClass(); Log.e(TAG, "Call to " + target.getSimpleName() + "::setHasOptionsMenu(boolean) is forbidden! Call was obsolete. Remove this call from your source!"); } }
Created attachment 261288 [details] new crash Trying to exclude from this problem aspect the last one point+advice I've got new error.
Created attachment 261306 [details] strange crash All these crashes occurs when compiled aspect classes are passing to -aspectpath parameter. And all that looks strange :(
I am suspecting these problems are due to something else altering the class files. All the issues indicate we aren't finding what we expect in the constant pool. I notice Android in there - are you using any android tools on the class files? If, after compiling the aspects initially, something operates on the classfile and adversely disturbs the constant pool then when AspectJ is called again to use the aspects, it can't understand them. This can happen if some kind of 'optimizer' step runs that throws away constant pool entries it thinks aren't being used (in fact they are being used, they are just being referred to from class file attributes AspectJ created).