Bug 407966

Summary: Advice has not been applied for method with parameterized type array argument
Product: [Tools] AspectJ Reporter: Svyatoslav Scherbina <sch.svyatoslav>
Component: CompilerAssignee: aspectj inbox <aspectj-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: aclement
Version: 1.7.2   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Svyatoslav Scherbina CLA 2013-05-14 02:02:38 EDT
---------------------- Aspect.aj ----------------------

public aspect Aspect {
        void around(): call(* Def.def(..)) {
                System.out.println("aspect");
        }
}

-------------------------------------------------------



---------------------- Def.java -----------------------

class Clazz<T> {
}

public class Def {
        public static void def(Clazz<?>[] c) {
                System.out.println("def");
        }
}

-------------------------------------------------------



---------------------- Use.java -----------------------

public class Use {
        public static void main(String[] argv) {
                Def.def(null);
        }
}

-------------------------------------------------------


When placing Def after Use, compiler does not apply the advice, i.e.


$ ajc -1.6  Aspect.aj Use.java Def.java
.../Aspect.aj:2 [warning] advice defined in Aspect has not been applied [Xlint:adviceDidNotMatch]
...

$ java Use
def


When placing Use after Def compiler works correctly:

$ ajc -1.6  Aspect.aj Def.java Use.java
$ java Use
aspect


Compiler accepts any order if method Def.def does not have an argument of type Clazz<?>[]
Comment 1 Andrew Clement CLA 2013-05-14 12:26:27 EDT
thanks for the great testcase!