diff options
author | jhugunin <jhugunin> | 2003-09-12 16:49:58 +0000 |
---|---|---|
committer | jhugunin <jhugunin> | 2003-09-12 16:49:58 +0000 |
commit | b5127388a3b5a2403e8d8944766bbe1895e09530 (patch) | |
tree | 1bc69df69075a48d0180b21e080f4c9f7bcaf9da /tests/bugs | |
parent | 3b79af95c2373158d6b4149476746e880866e385 (diff) | |
download | aspectj-b5127388a3b5a2403e8d8944766bbe1895e09530.tar.gz aspectj-b5127388a3b5a2403e8d8944766bbe1895e09530.zip |
fix and test for Bugzilla Bug 42993
Language regression, or possible language improvement?
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.
Diffstat (limited to 'tests/bugs')
-rw-r--r-- | tests/bugs/ParentsAndPointcuts.java | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/bugs/ParentsAndPointcuts.java b/tests/bugs/ParentsAndPointcuts.java new file mode 100644 index 000000000..522c29ea5 --- /dev/null +++ b/tests/bugs/ParentsAndPointcuts.java @@ -0,0 +1,44 @@ +import org.aspectj.testing.Tester; + +public class ParentsAndPointcuts { + public static void main(String[] args) { + ContainerDescriptor d = new ContainerDescriptor(); + Tester.check(d instanceof AbstractCaching.Key, "instanceof"); + } +} + +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)); +}
\ No newline at end of file |