From 6b2d9ae90158bd4e5cda5ecea5f3787400bab5af Mon Sep 17 00:00:00 2001 From: aclement Date: Wed, 17 May 2006 15:48:34 +0000 Subject: test update and fix for 138223: funky annotation matching --- tests/bugs152/pr138223/DoubleAnnotationMatching.aj | 57 ++++++++++++++-------- .../org/aspectj/systemtest/ajc152/Ajc152Tests.java | 2 +- tests/src/org/aspectj/systemtest/ajc152/ajc152.xml | 9 ++++ 3 files changed, 46 insertions(+), 22 deletions(-) (limited to 'tests') 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 diff --git a/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java b/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java index 178d54058..645a7f0a5 100644 --- a/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java @@ -51,7 +51,7 @@ public class Ajc152Tests extends org.aspectj.testing.XMLBasedAjcTestCase { public void testReferencePCutInDeclareWarning_pr138215() { runTest("Reference pointcut fails inside @DeclareWarning");} public void testReferencePCutInPerClause_pr138219() { runTest("Can't use a FQ Reference pointcut in any pointcut expression referenced by a per-clause");} public void testReferencePCutInPerClause_pr130722() { runTest("FQ Reference pointcut from perclause ref pc"); } -// public void testDoubleAnnotationMatching_pr138223() { runTest("Double at annotation matching (no binding)");} + public void testDoubleAnnotationMatching_pr138223() { runTest("Double at annotation matching (no binding)");} public void testSuperCallsInAtAspectJAdvice_pr139749() { runTest("Super calls in @AspectJ advice");} public void testNoClassCastExceptionWithPerThis_pr138286() { runTest("No ClassCastException with perThis");} diff --git a/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml b/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml index 6407865fb..122af5fdd 100644 --- a/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml +++ b/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml @@ -250,6 +250,15 @@ + + + + + + + + + -- cgit v1.2.3