diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ajcTests.xml | 6 | ||||
-rw-r--r-- | tests/bugs/ParentsAndPointcuts.java | 44 |
2 files changed, 50 insertions, 0 deletions
diff --git a/tests/ajcTests.xml b/tests/ajcTests.xml index a50e6940d..39dd3b146 100644 --- a/tests/ajcTests.xml +++ b/tests/ajcTests.xml @@ -6751,4 +6751,10 @@ <compile files="aspects/Softener.aj,test/NoSoftener.java"/> <run class="test.NoSoftener"/> </ajc-test> + + <ajc-test dir="bugs" pr="42993" + title="Interaction between pointcut binding and declare parents"> + <compile files="ParentsAndPointcuts.java"/> + <run class="ParentsAndPointcuts"/> + </ajc-test> </suite> 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 |