[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Potential bug: Reference to pointcut defined in aspect within interface

Hi all,

I have found a strange behaviour while using aspects within interfaces, when those interfaces get generics. For example:

public interface MyInterface1<T> {

	public abstract static aspect MyAspect1<T> {

		public void foo() {
			System.out.println("Fooooooo");
		}

		public final pointcut myPointcutInInterface() : 			call(* *..*.*(..));
	}
}

public aspect MyAspect implements MyInterface1<MyClass> {

	before() : 		MyAspect1<MyClass>.myPointcutInInterface() &&
		!within(MyAspect<MyClass>) {
		System.out.println("Before executing!");
	}
}

Results in an exception thrown by the AspectJ compiler:

java.lang.IllegalStateException
at org.aspectj.weaver.TypeFactory.createParameterizedType(TypeFactory.java:42)
at org.aspectj.weaver.patterns.WildTypePattern.resolveParameterizedType(WildTypePattern.java:790)
at org.aspectj.weaver.patterns.WildTypePattern.resolveBindingsForExactType(WildTypePattern.java:732)
at org.aspectj.weaver.patterns.WildTypePattern.resolveBindingsFromFullyQualifiedTypeName(WildTypePattern.java:699)
at org.aspectj.weaver.patterns.WildTypePattern.resolveBindings(WildTypePattern.java:623)
at org.aspectj.weaver.patterns.TypePattern.resolveExactType(TypePattern.java:190)
at org.aspectj.weaver.patterns.ReferencePointcut.resolveBindings(ReferencePointcut.java:130)
at org.aspectj.weaver.patterns.AndPointcut.resolveBindings(AndPointcut.java:74)
at org.aspectj.weaver.patterns.Pointcut.resolve(Pointcut.java:196)
at org.aspectj.ajdt.internal.compiler.ast.PointcutDesignator.finishResolveTypes(PointcutDesignator.java:84)
at org.aspectj.ajdt.internal.compiler.ast.AdviceDeclaration.resolveStatements(AdviceDeclaration.java:119)
at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:400)
at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1088)
at org.aspectj.ajdt.internal.compiler.ast.AspectDeclaration.resolve(AspectDeclaration.java:116)
at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1137)
at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:305)
at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:519)
at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:329)
at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:887)
at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:271)
at org.aspectj.ajdt.internal.core.builder.AjBuildManager.incrementalBuild(AjBuildManager.java:170)
at org.aspectj.ajde.internal.CompilerAdapter.compile(CompilerAdapter.java:117)
at org.aspectj.ajde.internal.AspectJBuildManager$CompilerThread.run(AspectJBuildManager.java:191)


IllegalStateException thrown: Expecting raw type

Without the generics, the program works just fine. I don't understand what is the problem. Can anyone help me, please? Thanks in advance.


Best regards,


Paulo Zenida

----------------------------------------------------------------
Mensagem enviada usando o IMP (Internet Messaging Program).