From 2b5329c2a672ff32f8c941f0c56e475ea58ce5f3 Mon Sep 17 00:00:00 2001 From: aclement Date: Mon, 30 Jan 2006 10:22:10 +0000 Subject: [PATCH] testcode for 125475/125480 (from matthew) and for enh 123423 (expose PTW type) --- tests/bugs151/pr125475/Test.java | 3 ++ tests/bugs151/pr125475/TestAspect.aj | 4 +++ .../pr125475/TestEmptyPointcutAtAspect.java | 10 ++++-- .../pr125475/TestEmptyPointcutAtAspect2.java | 28 +++++++++++++++ tests/bugs151/pr125475/aop.xml | 14 ++++++++ tests/bugs151/pr125480/AbstractMethods.aj | 13 +++++++ .../pr125480/AtAspectTestConcreteMethods.java | 6 ++++ tests/bugs151/pr125480/ConcreteMethods.aj | 7 ++++ tests/bugs151/pr125480/HelloWorld.java | 11 ++++++ tests/bugs151/pr125480/aop-tracing.xml | 10 ++++++ tests/features151/ptw/ExposedType.java | 25 +++++++++++++ .../org/aspectj/systemtest/ajc151/ajc151.xml | 35 +++++++++++++++++-- 12 files changed, 162 insertions(+), 4 deletions(-) create mode 100644 tests/bugs151/pr125475/Test.java create mode 100644 tests/bugs151/pr125475/TestAspect.aj create mode 100644 tests/bugs151/pr125475/TestEmptyPointcutAtAspect2.java create mode 100644 tests/bugs151/pr125475/aop.xml create mode 100644 tests/bugs151/pr125480/AbstractMethods.aj create mode 100644 tests/bugs151/pr125480/AtAspectTestConcreteMethods.java create mode 100644 tests/bugs151/pr125480/ConcreteMethods.aj create mode 100644 tests/bugs151/pr125480/HelloWorld.java create mode 100644 tests/bugs151/pr125480/aop-tracing.xml create mode 100644 tests/features151/ptw/ExposedType.java diff --git a/tests/bugs151/pr125475/Test.java b/tests/bugs151/pr125475/Test.java new file mode 100644 index 000000000..b8ad663ce --- /dev/null +++ b/tests/bugs151/pr125475/Test.java @@ -0,0 +1,3 @@ +public class Test { + public static void main (String[] args) {} +} diff --git a/tests/bugs151/pr125475/TestAspect.aj b/tests/bugs151/pr125475/TestAspect.aj new file mode 100644 index 000000000..ad5cbd666 --- /dev/null +++ b/tests/bugs151/pr125475/TestAspect.aj @@ -0,0 +1,4 @@ +public abstract aspect TestAspect { + + protected abstract pointcut scope (); +} diff --git a/tests/bugs151/pr125475/TestEmptyPointcutAtAspect.java b/tests/bugs151/pr125475/TestEmptyPointcutAtAspect.java index 12334f4b9..d249621b0 100644 --- a/tests/bugs151/pr125475/TestEmptyPointcutAtAspect.java +++ b/tests/bugs151/pr125475/TestEmptyPointcutAtAspect.java @@ -1,6 +1,12 @@ +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; + @Aspect public class TestEmptyPointcutAtAspect { - @Pointcut("") - protected void scope () {} + @Pointcut("") + protected void scope () {} + + @Pointcut + protected void scope2() {} } diff --git a/tests/bugs151/pr125475/TestEmptyPointcutAtAspect2.java b/tests/bugs151/pr125475/TestEmptyPointcutAtAspect2.java new file mode 100644 index 000000000..7b92bd05b --- /dev/null +++ b/tests/bugs151/pr125475/TestEmptyPointcutAtAspect2.java @@ -0,0 +1,28 @@ +import org.aspectj.lang.annotation.*; + +@Aspect +public class TestEmptyPointcutAtAspect2 { + + @Pointcut("") + protected void scope () {} + + @Before("within(*) && scope()") + public void m() { + System.err.println("Here!"); + } +} + +class A { + + String s; + int i; + + public static void main(String[] args) { + new A().foo(); + } + + public void foo() { + i=4; + s="hello"; + } +} \ No newline at end of file diff --git a/tests/bugs151/pr125475/aop.xml b/tests/bugs151/pr125475/aop.xml new file mode 100644 index 000000000..5b9dd55e6 --- /dev/null +++ b/tests/bugs151/pr125475/aop.xml @@ -0,0 +1,14 @@ + + + + + + + + + + diff --git a/tests/bugs151/pr125480/AbstractMethods.aj b/tests/bugs151/pr125480/AbstractMethods.aj new file mode 100644 index 000000000..e37065c87 --- /dev/null +++ b/tests/bugs151/pr125480/AbstractMethods.aj @@ -0,0 +1,13 @@ + + +public abstract aspect AbstractMethods { + + protected abstract pointcut tracingScope (); + + before () : tracingScope () { + test(); + } + + protected abstract void test (); +// protected void test () {} +} diff --git a/tests/bugs151/pr125480/AtAspectTestConcreteMethods.java b/tests/bugs151/pr125480/AtAspectTestConcreteMethods.java new file mode 100644 index 000000000..90e4cc34e --- /dev/null +++ b/tests/bugs151/pr125480/AtAspectTestConcreteMethods.java @@ -0,0 +1,6 @@ +import org.aspectj.lang.annotation.Aspect; + +@Aspect +public class AtAspectTestConcreteMethods extends ConcreteMethods { + +} diff --git a/tests/bugs151/pr125480/ConcreteMethods.aj b/tests/bugs151/pr125480/ConcreteMethods.aj new file mode 100644 index 000000000..efc23b5d2 --- /dev/null +++ b/tests/bugs151/pr125480/ConcreteMethods.aj @@ -0,0 +1,7 @@ + + +public abstract aspect ConcreteMethods extends AbstractMethods { + + protected void test () {} + +} diff --git a/tests/bugs151/pr125480/HelloWorld.java b/tests/bugs151/pr125480/HelloWorld.java new file mode 100644 index 000000000..f741a2c0e --- /dev/null +++ b/tests/bugs151/pr125480/HelloWorld.java @@ -0,0 +1,11 @@ +public class HelloWorld { + + public static void main(String[] args) { + new HelloWorld().println(); + } + + public void println() { + System.out.print("Hello World!"); + } + +} diff --git a/tests/bugs151/pr125480/aop-tracing.xml b/tests/bugs151/pr125480/aop-tracing.xml new file mode 100644 index 000000000..e31e52caf --- /dev/null +++ b/tests/bugs151/pr125480/aop-tracing.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/tests/features151/ptw/ExposedType.java b/tests/features151/ptw/ExposedType.java new file mode 100644 index 000000000..daa2974c8 --- /dev/null +++ b/tests/features151/ptw/ExposedType.java @@ -0,0 +1,25 @@ +public class ExposedType { + public static void main(String[] args) { + new ExposedTypeOne().foo(); + new ExposedTypeTwo().foo(); + new ExposedTypeThree().foo(); + } +} + +class ExposedTypeOne { + public void foo() { } +} + +class ExposedTypeTwo { + public void foo() { } +} + +class ExposedTypeThree { + public void foo() { } +} + +aspect X pertypewithin(Exposed*) { + before(): execution(* foo(..)) { + System.err.println("here I am "+thisJoinPoint+": for class "+getWithinType()); + } +} \ No newline at end of file diff --git a/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml b/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml index 212ac5589..99c2698d1 100644 --- a/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml +++ b/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml @@ -103,9 +103,40 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- 2.39.5