Archinamon/android-gradle-aspectj

Add experimental aj-compiler options

Archinamon opened this issue · 2 comments

-XhasMember allow hasmethod() and hasfield type patterns in declare parents and declare @type
-Xjoinpoints: supply a comma separated list of new joinpoints that can be identified by pointcuts. Values are: arrayconstruction, synchronization

Added new qualifier to gradle config:

aspectj {
    experimental true
}

Simple test of new experimental options:

public aspect TestExperimentalFeatures {

    pointcut testJoinPoints(): call(String[].new(..));
    before(): testJoinPoints() {
        Log.e(aspectOf().getClass().getSimpleName(), thisJoinPoint.toString());
    }

    interface Abc {}
    declare parents: AppCompatActivity+ && hasmethod(* getRouter()) implements Abc;
}

The joinpoint of array's constructors couldn't be catched before. Now it correctly supplies.
Now available to define hasmethod(MethodPattern) and hasfield(FieldPattern) directives to target exact classes in declare parents and declare @type morphemes.

Implemented.