diff options
author | aclement <aclement> | 2009-02-20 20:57:15 +0000 |
---|---|---|
committer | aclement <aclement> | 2009-02-20 20:57:15 +0000 |
commit | e8309925eb9c0a86d3cf6a786cb95fc4be349242 (patch) | |
tree | 9d86655367b03ca5ff0c6c8655a1c5888d2b004a /tests/bugs164/pr265695 | |
parent | 57dbf696735070a818bf33bf5b7e8e51a5f0ba5c (diff) | |
download | aspectj-e8309925eb9c0a86d3cf6a786cb95fc4be349242.tar.gz aspectj-e8309925eb9c0a86d3cf6a786cb95fc4be349242.zip |
265695: inherited anno matching
Diffstat (limited to 'tests/bugs164/pr265695')
-rw-r--r-- | tests/bugs164/pr265695/Asp.aj | 35 | ||||
-rw-r--r-- | tests/bugs164/pr265695/AspNew.aj | 32 |
2 files changed, 67 insertions, 0 deletions
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(); + } +} + |