Bug 407966 - Advice has not been applied for method with parameterized type array argument
Summary: Advice has not been applied for method with parameterized type array argument
Status: NEW
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.7.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-14 02:02 EDT by Svyatoslav Scherbina CLA
Modified: 2013-05-14 12:26 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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!