Bug 395221 - weird error about unbound formals when mixing generics with annotation style
Summary: weird error about unbound formals when mixing generics with annotation style
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: 1.7.2   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-27 17:34 EST by Andrew Clement CLA
Modified: 2012-11-27 17:53 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Clement CLA 2012-11-27 17:34:23 EST
From the mailing list:

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?
Comment 1 Andrew Clement CLA 2012-11-27 17:38:40 EST
this is due to the parameterization of the pointcuts in the sub-aspect, which loses the 'fields to ignore' list in the AndPointcut.  Thus pjp is not ignored and is reported as a problem
Comment 2 Andrew Clement CLA 2012-11-27 17:53:19 EST
fixed