Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AJDT » A simple parametrized class question(aspectj pointcut for parametrized class)
A simple parametrized class question [message #1052871] Tue, 30 April 2013 20:27 Go to next message
s t is currently offline s tFriend
Messages: 1
Registered: April 2013
Junior Member

I have a parametrized class, I want to intercept methods inside the class.
The below code snippet seems not to work.
Is it the correct usage? Using raw type name should work?

Apologies for the newbie question!

I am using aspectj-maven-plugin 1.3 , and aspectjrt version 1.6.2


package somepack;
public class Someclass<T> {
public void someFunc( T arg){}

public void withinSomePackAndClass() {}

These do not seem to match :

pointcut = "args(argument) && ( execution(public * someFunc ( .. )) && withinSomePackAndClass() )"

or even

pointcut = "args(argument) && ( execution(public * someFunc ( .. )) )"

Re: A simple parametrized class question [message #1052967 is a reply to message #1052871] Wed, 01 May 2013 15:44 Go to previous message
Andrew Eisenberg is currently offline Andrew EisenbergFriend
Messages: 382
Registered: July 2009
Senior Member
Your problem is with 'args(argument)'. I'm guessing that you want to bind the argument to something in the advice. You should do something like this:

    pointcut = "args(argument) && ( execution(public * someFunc ( .. )) && withinSomePackAndClass() )"
    public <T> void meth(T argument) { }

Now, there's also the possibility that this is just not working in AJ 1.6.2. Tbat is an old version of AJ. @AspectJ style had many problems with generics. I would recommend that you upgrade to 1.7.3 where this syntax is known to work.
Previous Topic:can't create class
Next Topic:IllegalMonitorStateException using locks
Goto Forum:

Current Time: Thu Feb 20 11:13:41 GMT 2020

Powered by FUDForum. Page generated in 0.02698 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top