From 6b2526fdda56e30d8a151ca0b9bd16ecb690d3d0 Mon Sep 17 00:00:00 2001 From: acolyer Date: Mon, 24 Apr 2006 17:46:06 +0000 Subject: [PATCH] test cases for pr138215, 219, and 223. --- tests/bugs152/pr138215/pr138215.aj | 19 +++++++++++ .../bugs152/pr138219/PerThisWithReference.aj | 7 ++++ tests/bugs152/pr138219/SomeOtherType.aj | 5 +++ .../bugs152/pr138220/AtAspectWithPerClause.aj | 17 ++++++++++ .../pr138223/DoubleAnnotationMatching.aj | 33 +++++++++++++++++++ .../systemtest/ajc152/Ajc152Tests.java | 8 +++++ .../org/aspectj/systemtest/ajc152/ajc152.xml | 21 ++++++++++++ 7 files changed, 110 insertions(+) create mode 100644 tests/bugs152/pr138215/pr138215.aj create mode 100644 tests/bugs152/pr138219/PerThisWithReference.aj create mode 100644 tests/bugs152/pr138219/SomeOtherType.aj create mode 100644 tests/bugs152/pr138220/AtAspectWithPerClause.aj create mode 100644 tests/bugs152/pr138223/DoubleAnnotationMatching.aj diff --git a/tests/bugs152/pr138215/pr138215.aj b/tests/bugs152/pr138215/pr138215.aj new file mode 100644 index 000000000..7580b146b --- /dev/null +++ b/tests/bugs152/pr138215/pr138215.aj @@ -0,0 +1,19 @@ +package abc; +import org.aspectj.lang.annotation.*; + +@Aspect +public class pr138215 { + + @DeclareWarning("fooExecution()") + public static final String warning = "no foos please"; + + @Pointcut("execution(* foo())") + public void fooExecution() {} + +} + +class Fooey { + + public void foo() {} + +} \ No newline at end of file diff --git a/tests/bugs152/pr138219/PerThisWithReference.aj b/tests/bugs152/pr138219/PerThisWithReference.aj new file mode 100644 index 000000000..c53466dfe --- /dev/null +++ b/tests/bugs152/pr138219/PerThisWithReference.aj @@ -0,0 +1,7 @@ +public aspect PerThisWithReference perthis(mypc()) { + + + pointcut mypc() : SomeOtherType.pc(); + + +} \ No newline at end of file diff --git a/tests/bugs152/pr138219/SomeOtherType.aj b/tests/bugs152/pr138219/SomeOtherType.aj new file mode 100644 index 000000000..51f0f3e5c --- /dev/null +++ b/tests/bugs152/pr138219/SomeOtherType.aj @@ -0,0 +1,5 @@ +public aspect SomeOtherType { + + public pointcut pc() : execution(* *(..)); + +} \ No newline at end of file diff --git a/tests/bugs152/pr138220/AtAspectWithPerClause.aj b/tests/bugs152/pr138220/AtAspectWithPerClause.aj new file mode 100644 index 000000000..729644328 --- /dev/null +++ b/tests/bugs152/pr138220/AtAspectWithPerClause.aj @@ -0,0 +1,17 @@ +import org.aspectj.lang.annotation.*; + +@Aspect("perthis(pc())") +public class AtAspectWithPerClause { + + @Pointcut("execution(* *(..))") + public void pc() {} + +} + +@Aspect +class Foo { + + @Pointcut("execution(* *(..))") + public void pc() {} + +} \ No newline at end of file diff --git a/tests/bugs152/pr138223/DoubleAnnotationMatching.aj b/tests/bugs152/pr138223/DoubleAnnotationMatching.aj new file mode 100644 index 000000000..415309421 --- /dev/null +++ b/tests/bugs152/pr138223/DoubleAnnotationMatching.aj @@ -0,0 +1,33 @@ +import java.lang.annotation.*; + +@Retention(RetentionPolicy.RUNTIME) +@interface Tx { + boolean readOnly() default false; +} + +public aspect DoubleAnnotationMatching { + + + pointcut methodInTxType(Tx tx) : + execution(* *(..)) && @this(tx) && if(tx.readOnly()); + + pointcut txMethod(Tx tx) : + execution(* *(..)) && @annotation(tx) && if(tx.readOnly()); + + pointcut transactionalOperation() : + methodInTxType(Tx) || txMethod(Tx); + + before() : transactionalOperation() { + // do something + } + +} + +@Tx class Foo { + + public void foo() {} + + @Tx public void bar() {} + + +} \ 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 de76cc76f..87a912be1 100644 --- a/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java @@ -31,7 +31,15 @@ public class Ajc152Tests extends org.aspectj.testing.XMLBasedAjcTestCase { public void testStackOverflow_pr136258() { runTest("stack overflow");} public void testIncorrectOverridesEvaluation13() { runTest("incorrect overrides evaluation - 1.3"); } public void testIncorrectOverridesEvaluation15() { runTest("incorrect overrides evaluation - 1.5"); } + + // known failures, uncomment when working. +// 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 testDoubleAnnotationMatching_pr138223() { runTest("Double at annotation matching (no binding)");} +// this next one reported as a bug by Rob Harrop, but I can't reproduce the failure yet... +//public void testAtAspectWithReferencePCPerClause_pr138220() { runTest("@Aspect with reference pointcut in perclause");} + ///////////////////////////////////////// public static Test suite() { return XMLBasedAjcTestCase.loadSuite(Ajc152Tests.class); diff --git a/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml b/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml index 7fb993960..cc57b9562 100644 --- a/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml +++ b/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml @@ -133,4 +133,25 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- 2.39.5