Bug 108437 - Problem matching pointcut when vararg is a type parameter
Summary: Problem matching pointcut when vararg is a type parameter
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.5.0M3   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 1.5.0 M4   Edit
Assignee: Adrian Colyer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-30 20:14 EDT by Roman Kishchenko CLA
Modified: 2005-09-06 04:05 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 Roman Kishchenko CLA 2005-08-30 20:14:21 EDT
The pointcut in the example below is not applied.

public class Test1<E> {
    public void method1(E...args) {
    }
}

public aspect TestAspect {
    after(Test1 test1, Object[] arg) returning: 
        execution(* Test1.method1(Object...)) && target(test1) && args(arg) 
    {
        System.out.println("got here");
    }
}

The error occurs only if vararg is a type parameter. 

Removing vararg argument arg from the pointcut declaration (as below) fixes
pointcut matching. Changing varag to be a generic type with type parameter E
(for example, List<E>) also fixes the problem.

public aspect TestAspect {
    after(Test1 test1) returning: execution(* Test1.method1(Object...)) && 
target(test1) 
    {
        System.out.println("got here");
    }
}
Comment 1 Adrian Colyer CLA 2005-08-31 04:08:33 EDT
this is now fixed in the tree... I just need to kick the build machine back into
life so that it will publish a new build to the download page incorporating the fix.
Comment 2 Adrian Colyer CLA 2005-08-31 06:18:48 EDT
fix now available in latest build on AspectJ download page.
Comment 3 Adrian Colyer CLA 2005-09-06 04:05:38 EDT
The fix is incorporated in the *AspectJ* compiler download, but AspectJ compiler
development builds are not automatically rolled into AJDT - instead AJDT takes
drops of the compiler at set intervals. When AJDT next upgrades their compiler
level (which we should try and do again soon) then this fix will be available
from AJDT too.