Community
Participate
Working Groups
The file AspectBug.java: public aspect AspectBug extends AbstractCaching perthis(execution(ContainerLoader+.new(..))) { declare parents: ContainerDescriptor implements AbstractCaching.Key; protected pointcut loadExecutions( Key key ): ContainerLoader.containerLoads( *, key ); } abstract aspect AbstractCaching { interface Key {} protected abstract pointcut loadExecutions(Key key); } class Key { } class ContainerDescriptor { } class ActiveContainer { } class ContainerLoader { public ActiveContainer createContainer(ContainerDescriptor c) { return null; } public pointcut containerLoads(ContainerLoader loader, ContainerDescriptor containerDesc ): this(loader) && args(containerDesc) && execution(ActiveContainer ContainerLoader.createContainer (ContainerDescriptor)); } First, here are the versions of AspectJ I'm using (this is a bash shell under cygwin on Windows XP): ~> CLASSPATH='C:\aspectj1.0\lib\aspectjrt.jar' /cygdrive/c/aspectj1.0/bin/ajc - version ajc version 1.0.6 (built Jul 24, 2002 6:21 PM PST) running on java 1.4.1_02 ~> CLASSPATH='C:\aspectj1.1\lib\aspectjrt.jar' /cygdrive/c/aspectj1.1/bin/ajc - version AspectJ Compiler 1.1.0 ~> CLASSPATH='C:\aspectj1.1.1rc1 \lib\aspectjrt.jar' /cygdrive/c/aspectj1.1.1rc1/bin/ajc -version AspectJ Compiler 1.1.1rc1 ~> CLASSPATH='C:\aspectj1.1.1 \lib\aspectjrt.jar' /cygdrive/c/aspectj1.1.1/bin/ajc -version AspectJ Compiler 1.1.1 For all four of these compilers, I give them the AspectBug.java file (which is attached): ~> CLASSPATH='C:\aspectj1.0\lib\aspectjrt.jar' /cygdrive/c/aspectj1.0/bin/ajc AspectBug.java ~> CLASSPATH='C:\aspectj1.1\lib\aspectjrt.jar' /cygdrive/c/aspectj1.1/bin/ajc AspectBug.java ~> CLASSPATH='C:\aspectj1.1.1rc1 \lib\aspectjrt.jar' /cygdrive/c/aspectj1.1.1rc1/bin/ajc AspectBug.java ~> CLASSPATH='C:\aspectj1.1.1 \lib\aspectjrt.jar' /cygdrive/c/aspectj1.1.1/bin/ajc AspectBug.java C:\Documents and Settings\Macneil Shonle\AspectBug.java:7 incompatible type, expected ContainerDescriptor found BindingTypePattern(AbstractCaching$Key, 0) 1 error As you can see, only the final run (with the Sept 11 build of ajc) do we see the "incompatible type" error. If this is not a regression but a desirable result, how should the code be ported?
This is a regression bug, and was easily reproduced from the nice self-contained test included below. It's marked as P1 because it is a regression from 1.1.0 and 1.1.1rc1. This test is now in HEAD, along with a fix for the bug. The problem was caused by moving name binding in pointcut declarations to happen before declare parents are evaluated. Because of this, the compiler doesn't know that ContainerDescriptor isa Key when resolving the ContainerLoader.containerLoads reference. The change in ordering was made to fix a bug reported in declare error and declare soft whose pcds where being evaluated before name binding had happened in the pointcut declarations. Unfortunately, declare error and declare soft are concretized at the same time as declare parents (and all other declares , so this move also led to the regression noted above.