diff options
author | aclement <aclement> | 2006-05-17 15:48:34 +0000 |
---|---|---|
committer | aclement <aclement> | 2006-05-17 15:48:34 +0000 |
commit | 6b2d9ae90158bd4e5cda5ecea5f3787400bab5af (patch) | |
tree | 1cfeecc8b5648b462968e636128686fb2e99bbd4 /tests/bugs152/pr138223/DoubleAnnotationMatching.aj | |
parent | 2c5fd746cb28ed8ad3990229ea2f861bbb815821 (diff) | |
download | aspectj-6b2d9ae90158bd4e5cda5ecea5f3787400bab5af.tar.gz aspectj-6b2d9ae90158bd4e5cda5ecea5f3787400bab5af.zip |
test update and fix for 138223: funky annotation matching
Diffstat (limited to 'tests/bugs152/pr138223/DoubleAnnotationMatching.aj')
-rw-r--r-- | tests/bugs152/pr138223/DoubleAnnotationMatching.aj | 57 |
1 files changed, 36 insertions, 21 deletions
diff --git a/tests/bugs152/pr138223/DoubleAnnotationMatching.aj b/tests/bugs152/pr138223/DoubleAnnotationMatching.aj index 415309421..ad163d007 100644 --- a/tests/bugs152/pr138223/DoubleAnnotationMatching.aj +++ b/tests/bugs152/pr138223/DoubleAnnotationMatching.aj @@ -1,33 +1,48 @@ import java.lang.annotation.*; -@Retention(RetentionPolicy.RUNTIME) -@interface Tx { - boolean readOnly() default false; -} +@Retention(RetentionPolicy.RUNTIME) @interface Tx {boolean value() default false;} public aspect DoubleAnnotationMatching { - - - pointcut methodInTxType(Tx tx) : - execution(* *(..)) && @this(tx) && if(tx.readOnly()); + pointcut methodInTxType(Tx tx) : + execution(* *(..)) && @this(tx) && if(tx.value()); - pointcut txMethod(Tx tx) : - execution(* *(..)) && @annotation(tx) && if(tx.readOnly()); + pointcut txMethod(Tx tx) : + execution(* *(..)) && @annotation(tx) && if(tx.value()); - pointcut transactionalOperation() : - methodInTxType(Tx) || txMethod(Tx); + pointcut transactionalOperation() : + methodInTxType(Tx) || txMethod(Tx); - before() : transactionalOperation() { - // do something - } - + before() : transactionalOperation() { + System.err.println("advice running at "+thisJoinPoint); + } + + public static void main(String [] argv) { + new Foo().a(); + new Foo().b(); + new Foo().c(); + new TxTrueFoo().a(); + new TxTrueFoo().b(); + new TxTrueFoo().c(); + new TxFalseFoo().a(); + new TxFalseFoo().b(); + new TxFalseFoo().c(); + } } -@Tx class Foo { - - public void foo() {} - - @Tx public void bar() {} +@Tx(true) class TxTrueFoo { + @Tx(true) public void a() {} + @Tx(false) public void b() {} + public void c() {} +} +@Tx(false) class TxFalseFoo { + @Tx(true) public void a() {} + @Tx(false) public void b() {} + public void c() {} +} +class Foo { + @Tx(true) public void a() {} + @Tx(false) public void b() {} + public void c() {} }
\ No newline at end of file |