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 16:27 Go to next message
s t is currently offline s t
Messages: 1
Registered: April 2013
Junior Member
Hi,

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

Thanks,
-Srini

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

@Pointcut("within(somepack.Someclass)")
public void withinSomePackAndClass() {}

These do not seem to match :

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

or even

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

Re: A simple parametrized class question [message #1052967 is a reply to message #1052871] Wed, 01 May 2013 11:44 Go to previous message
Andrew Eisenberg is currently offline Andrew Eisenberg
Messages: 307
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:

    @AfterReturning(
    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:Duplicate classes when using maven weave dependencies
Next Topic:IllegalMonitorStateException using locks
Goto Forum:
  


Current Time: Tue May 28 04:46:19 EDT 2013

Powered by FUDForum. Page generated in 0.01520 seconds