Skip to main content

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

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


Back to the top