Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Pointcut not matching when using Generics

Your two programs just compiled fine for me:

N:\aspectj168>ajc -showWeaveInfo -1.5 Main.java Captures.java
Join point 'method-execution(java.util.List Main.doS())' in Type
'Main' (Main.java:5) advised by around advice from 'Captures'
(Captures.java:12)

What version of AspectJ are you on?  (I am using 1.6.8).  I presume
you are compiling on the command line (as you are using showWeaveInfo)
- how does your compile command differ from mine?

Andy

On 20 May 2010 15:27, Bhaskar Maddala <maddalab@xxxxxxxxx> wrote:
> Hello,
>
>  I am having trouble with generic type signature and matching
> joinpoints for an execution pointcut
>
>  I have the following
>
> import java.util.Collections;
> import java.util.List;
>
> public class Main {
>    public List<String> doS() {
>        return Collections.emptyList();
>    }
>
>    public static void main(String[] args) {
>        new Main().doS();
>    }
> }
>
> And an aspect
>
> import java.util.Collections;
>
> import org.aspectj.lang.ProceedingJoinPoint;
> import org.aspectj.lang.annotation.Around;
> import org.aspectj.lang.annotation.Aspect;
> import org.aspectj.lang.annotation.Pointcut;
>
> @Aspect
> public class Captures {
>
>    @Around("execution(public java.util.List<java.lang.String> Main.doS())")
>    public Object quickTest(ProceedingJoinPoint pjp) throws Throwable {
>        pjp.proceed();
>        System.out.println("Se");
>        return Collections.emptyList();
>    }
> }
>
> I have showweaveinfo set to true and when building do not see any
> information (tried running and did not see the output on the screen).
> I replace the execution pointcut on quickTest to
>
>    @Around("execution(public java.util.List Main.doS())")
>
> and see the output when running, also the weave info.
>
> Looking through the documentation
>
> http://www.eclipse.org/aspectj/doc/released/adk15notebook/generics-inAspectJ5.html
>
> I do not see what I am doing wrong
>
> Thanks
> Bhaskar
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>


Back to the top