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

Any time the AspectJ compiler throws an exception, it's a bug.

You might try the latest development build to see if it's been found and fixed.

Otherwise, please submit your code in a bug: 

  https://bugs.eclipse.org/bugs/enter_bug.cgi?product=AspectJ

Thanks -
Wes

> ------------Original Message------------
> From: Paulo Alexandre Corigo Zenida <paulo.zenida@xxxxxxxx>
> To: "AspectJ Mailing List" <aspectj-users@xxxxxxxxxxx>
> Date: Sat, Sep-2-2006 2:20 PM
> Subject: [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).
> 
> 
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>