Bug 492523 - BCException: Bad type signature RuntimeVisibleAnnotations
Summary: BCException: Bad type signature RuntimeVisibleAnnotations
Status: NEW
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.8.9   Edit
Hardware: Macintosh Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-27 05:09 EDT by Eduard Matsukov CLA
Modified: 2016-04-28 14:50 EDT (History)
1 user (show)

See Also:


Attachments
crash log (57.47 KB, text/plain)
2016-04-27 05:09 EDT, Eduard Matsukov CLA
no flags Details
new crash (57.60 KB, text/plain)
2016-04-27 05:18 EDT, Eduard Matsukov CLA
no flags Details
strange crash (57.99 KB, text/plain)
2016-04-27 11:27 EDT, Eduard Matsukov CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eduard Matsukov CLA 2016-04-27 05:09:00 EDT
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!");
    }
}
Comment 1 Eduard Matsukov CLA 2016-04-27 05:18:53 EDT
Created attachment 261288 [details]
new crash

Trying to exclude from this problem aspect the last one point+advice I've got new error.
Comment 2 Eduard Matsukov CLA 2016-04-27 11:27:13 EDT
Created attachment 261306 [details]
strange crash

All these crashes occurs when compiled aspect classes are passing to -aspectpath parameter.
And all that looks strange :(
Comment 3 Andrew Clement CLA 2016-04-28 14:50:28 EDT
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).