Skip to main content



      Home
Home » Language IDEs » AspectJ » 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
Eclipse UserFriend
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
Eclipse UserFriend
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:can't create class
Next Topic:IllegalMonitorStateException using locks
Goto Forum:
  


Current Time: Thu May 22 03:41:46 EDT 2025

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

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

Back to the top