From e8309925eb9c0a86d3cf6a786cb95fc4be349242 Mon Sep 17 00:00:00 2001 From: aclement Date: Fri, 20 Feb 2009 20:57:15 +0000 Subject: [PATCH] 265695: inherited anno matching --- tests/bugs164/pr265695/Asp.aj | 35 +++++++++++++++++++ tests/bugs164/pr265695/AspNew.aj | 32 +++++++++++++++++ .../systemtest/ajc164/Ajc164Tests.java | 18 ++++++---- .../org/aspectj/systemtest/ajc164/ajc164.xml | 15 +++++++- 4 files changed, 93 insertions(+), 7 deletions(-) create mode 100644 tests/bugs164/pr265695/Asp.aj create mode 100644 tests/bugs164/pr265695/AspNew.aj diff --git a/tests/bugs164/pr265695/Asp.aj b/tests/bugs164/pr265695/Asp.aj new file mode 100644 index 000000000..296cb1f36 --- /dev/null +++ b/tests/bugs164/pr265695/Asp.aj @@ -0,0 +1,35 @@ +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Retention(RetentionPolicy.RUNTIME) +@interface Secured { + String value(); +} + +interface DemoService { + @Secured("READ") + void secureMethod(); +} + + +class DemoServiceImpl implements DemoService { + public void secureMethod() { } +} + +aspect X { + // None of these match, the subject at execution(secureMethod()) does not have the annotation + // see http://www.eclipse.org/aspectj/doc/next/adk15notebook/join-point-modifiers.html + before(): execution(@Secured * *Service+.*(..)) { } + + before(): execution(@Secured * *Service.*(..)) { } + + before(): execution(@Secured * DemoService.*(..)) { } + +} + +public class Asp { + public static void main(String[] args) { + new DemoServiceImpl().secureMethod(); + } +} + diff --git a/tests/bugs164/pr265695/AspNew.aj b/tests/bugs164/pr265695/AspNew.aj new file mode 100644 index 000000000..ae99590fb --- /dev/null +++ b/tests/bugs164/pr265695/AspNew.aj @@ -0,0 +1,32 @@ +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Retention(RetentionPolicy.RUNTIME) +@interface Secured { + String value(); +} + +interface DemoService { + @Secured("READ") + void secureMethod(); +} + + +class DemoServiceImpl implements DemoService { + public void secureMethod() { } +} + +aspect X { + // None of these match, the subject at execution(secureMethod()) does not have the annotation + // see http://www.eclipse.org/aspectj/doc/next/adk15notebook/join-point-modifiers.html + before(): execution(@Secured! * *Service+.*(..)) { } + + +} + +public class AspNew { + public static void main(String[] args) { + new DemoServiceImpl().secureMethod(); + } +} + diff --git a/tests/src/org/aspectj/systemtest/ajc164/Ajc164Tests.java b/tests/src/org/aspectj/systemtest/ajc164/Ajc164Tests.java index 2351c665f..6de409bdd 100644 --- a/tests/src/org/aspectj/systemtest/ajc164/Ajc164Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc164/Ajc164Tests.java @@ -32,6 +32,14 @@ import org.aspectj.testing.XMLBasedAjcTestCase; public class Ajc164Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + public void testAnnoInherited_pr265695() { + runTest("anno inherited"); + } + + // public void testAnnoInherited_pr265695_2() { + // runTest("new syntax for inherited anno - 1"); + // } + public void testParserProblemSubArrayPatterns_pr148508() { runTest("parser problem for array subtypes"); } @@ -43,7 +51,7 @@ public class Ajc164Tests extends org.aspectj.testing.XMLBasedAjcTestCase { public void testIncorrectDateResolution_pr265360() { runTest("incorrect resolution of Date"); } - + public void testDualPreClinit_pr233032() { runTest("dual preClinit"); } @@ -144,11 +152,9 @@ public class Ajc164Tests extends org.aspectj.testing.XMLBasedAjcTestCase { } /** - * This test checks that local variable table for the interMethodDispatcher - * is built correctly, for the related code see - * IntertypeMethodDeclaration.generateDispatchMethod(). It checks non-static - * and static ITDs. Once the information here is correct then around advice - * on ITDs can also be correct. + * This test checks that local variable table for the interMethodDispatcher is built correctly, for the related code see + * IntertypeMethodDeclaration.generateDispatchMethod(). It checks non-static and static ITDs. Once the information here is + * correct then around advice on ITDs can also be correct. */ public void testBrokenLVT_pr194314_3() throws Exception { runTest("broken lvt - 3"); diff --git a/tests/src/org/aspectj/systemtest/ajc164/ajc164.xml b/tests/src/org/aspectj/systemtest/ajc164/ajc164.xml index 9dbe25479..11acc2979 100644 --- a/tests/src/org/aspectj/systemtest/ajc164/ajc164.xml +++ b/tests/src/org/aspectj/systemtest/ajc164/ajc164.xml @@ -1,6 +1,20 @@ + + + + + + + + + + + + + + @@ -21,7 +35,6 @@ - -- 2.39.5