Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Problem with @Aspect using generics

Hello Andy,

thank you for fast reaction! 

regards
Leon

On Tue, Nov 27, 2012 at 11:54 PM, Andy Clement <andrew.clement@xxxxxxxxx> wrote:
Hi Leon,

thanks for helping me recreate it by sharing that code. I just raised it as https://bugs.eclipse.org/bugs/show_bug.cgi?id=395221 and fixed it.

Next dev build (and the 1.7.2 release) will contain the fix.

cheers,
Andy


On 27 November 2012 12:19, Leon Rosenberg <rosenberg.leon@xxxxxxxxx> wrote:
Hello Andy,

thank you for your time.

Sorry about the link, the guest access works over svn serve protocol, so its 

I tried to build with 1.7.1 but had similar error:
[ERROR] Failed to execute goal org.codehaus.mojo:aspectj-maven-plugin:1.4:compile (default) on project moskito-aop: Compiler errors:
[ERROR] error at @Around(value = "execution(* *(..)) && (@annotation(method))")
[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] /Users/another/projects/moskito/moskito-aop/java/net/anotheria/moskito/aop/aspect/MonitoringAspect.java:30:0::0 the parameter pjp is not bound in [all branches of] pointcut
[ERROR] error at @Around(value = "execution(* *.*(..)) && (@within(clazz) && !@annotation(net.anotheria.moskito.aop.annotation.DontMonitor))")
[ERROR] public Object doProfilingClass(ProceedingJoinPoint pjp, Monitor clazz) throws Throwable {
[ERROR] return doProfiling(pjp, clazz.producerId(), clazz.subsystem(), clazz.category());
[ERROR] }

Should I provide the both java files and build output?
regards
Leon


On Tue, Nov 27, 2012 at 8:08 PM, Andy Clement <andrew.clement@xxxxxxxxx> wrote:
Hi,

I tried to clone the repo but it is asking for userid/password.  So then I tried to recreate the problem myself but in a simple setup I don't see the error - but then I am using AspectJ 1.7.1 rather than 1.6.11.  If you set it up so I can clone the repo I will try again.  It sounds like a bug you have hit but I can't confirm until I can recreate. You could try using code style rather than annotation style to see if that fixes things, but then you will have to proceed on the joinpoint in the advice.

cheers,
Andy


On 22 November 2012 15:05, Leon Rosenberg <rosenberg.leon@xxxxxxxxx> wrote:
Hello,
I have following problem with following Aspect:

@Aspect
public class CounterAspect extends AbstractMoskitoAspect {

@Around(value = "execution(* *(..)) && (@annotation(method))")
    public Object countMethod(ProceedingJoinPoint pjp, Count method) throws Throwable {
    return count(pjp, method.producerId(), method.subsystem(), method.category());
    }

@Around(value = "execution(* *(..)) && (@annotation(method))")
public Object countByParameter(ProceedingJoinPoint pjp, CountByParameter method) throws Throwable {
return countByParameter(pjp, method.producerId(), method.subsystem(), method.category());
}

@Around(value = "execution(* *.*(..)) && (@within(clazz))")
    public Object countClass(ProceedingJoinPoint pjp, Count clazz) throws Throwable {
    return count(pjp, clazz.producerId(), clazz.subsystem(), clazz.category());
    }

private Object countByParameter(ProceedingJoinPoint pjp, String aProducerId, String aSubsystem, String aCategory) throws Throwable {
....

It works. However, since I have two similar aspects that differ only in using some internal classes, I made my super class using generics:
public class AbstractMoskitoAspect<S extends IStats> {

@Aspect
public class CounterAspect extends AbstractMoskitoAspect<CounterStats> {

this breaks the build instantly with the very unhelpful error message:
[ERROR] Failed to execute goal org.codehaus.mojo:aspectj-maven-plugin:1.4:compile (default) on project moskito-aop: Compiler errors:
[ERROR] error at @Around(value = "execution(* *(..)) && (@annotation(method))")
[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] /Users/another/projects/moskito/moskito-aop/java/net/anotheria/moskito/aop/aspect/CounterAspect.java:24:0::0 the parameter pjp is not bound in [all branches of] pointcut
[ERROR] error at @Around(value = "execution(* *(..)) && (@annotation(method))")
[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] /Users/another/projects/moskito/moskito-aop/java/net/anotheria/moskito/aop/aspect/CounterAspect.java:29:0::0 the parameter pjp is not bound in [all branches of] pointcut
[ERROR] error at @Around(value = "execution(* *.*(..)) && (@within(clazz))")
[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] /Users/another/projects/moskito/moskito-aop/java/net/anotheria/moskito/aop/aspect/CounterAspect.java:34:0::0 the parameter pjp is not bound in [all branches of] pointcut

what am i doing wrong here?


aspectj 1.6.11, mvn 3, mvn aspectj plugin 1.4
how to reproduce:
edit net.anotheria.moskito.aop.aspect.CounterAspect, change
public class CounterAspect extends AbstractMoskitoAspect {
to
public class CounterAspect extends AbstractMoskitoAspect<CounterStats> {

run mvn clean install

thanks for your time
Leon











_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



Back to the top