diff options
author | aclement <aclement> | 2008-06-11 19:40:32 +0000 |
---|---|---|
committer | aclement <aclement> | 2008-06-11 19:40:32 +0000 |
commit | b794e2a851cfe3219159ae078a6c76f05753827f (patch) | |
tree | 3ec0366799eb90181ea5b665bb8eeb4165eff915 /tests/bugs161 | |
parent | 06f056227ea78ef424f9c5baf91148d208ff3df8 (diff) | |
download | aspectj-b794e2a851cfe3219159ae078a6c76f05753827f.tar.gz aspectj-b794e2a851cfe3219159ae078a6c76f05753827f.zip |
197719: second testcase
Diffstat (limited to 'tests/bugs161')
-rw-r--r-- | tests/bugs161/pr197719/test/aspects/C1.java | 15 | ||||
-rw-r--r-- | tests/bugs161/pr197719/test/aspects/C3.java | 42 | ||||
-rw-r--r-- | tests/bugs161/pr197719/test/aspects/MyAnn.java | 13 | ||||
-rw-r--r-- | tests/bugs161/pr197719/test/aspects/MyAnnAspect.java | 24 | ||||
-rw-r--r-- | tests/bugs161/pr197719/test/aspects2/C2.java | 34 |
5 files changed, 128 insertions, 0 deletions
diff --git a/tests/bugs161/pr197719/test/aspects/C1.java b/tests/bugs161/pr197719/test/aspects/C1.java new file mode 100644 index 000000000..a82ab4c8f --- /dev/null +++ b/tests/bugs161/pr197719/test/aspects/C1.java @@ -0,0 +1,15 @@ +package test.aspects; + + +public class C1 { + + @MyAnn + protected void aMethod() { + System.out.println("Calling aMethod"); + } + + public void callAMethod() { + aMethod(); // Should be a marker here... + } + +} diff --git a/tests/bugs161/pr197719/test/aspects/C3.java b/tests/bugs161/pr197719/test/aspects/C3.java new file mode 100644 index 000000000..64a5ba035 --- /dev/null +++ b/tests/bugs161/pr197719/test/aspects/C3.java @@ -0,0 +1,42 @@ +package test.aspects; + +import test.aspects2.C2; + + +public class C3 { + + public void callAMethodC2() { + C1 c1 = new C1(); + c1.aMethod(); // Should be a marker here... + + C2 c2 = new C2(); + c2.aMethod(); // Should be a marker here... + } + + public void innerClassCall() { + InnerClass ic = new InnerClass(); + + ic.foo(); + } + protected class InnerClass { + public void foo() { + C1 c1 = new C1(); + c1.aMethod(); // Should be a marker here... + + C2 c2 = new C2(); + c2.aMethod(); // Should be a marker here... + } + } + + public static void main(String [] args) { + C1 c1 = new C1(); + + c1.aMethod(); // Should be a marker here... + c1.callAMethod(); + + C3 c2 = new C3(); + + c2.callAMethodC2(); + c2.innerClassCall(); + } +} diff --git a/tests/bugs161/pr197719/test/aspects/MyAnn.java b/tests/bugs161/pr197719/test/aspects/MyAnn.java new file mode 100644 index 000000000..ccad57dad --- /dev/null +++ b/tests/bugs161/pr197719/test/aspects/MyAnn.java @@ -0,0 +1,13 @@ +package test.aspects; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Inherited +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +public @interface MyAnn { +} diff --git a/tests/bugs161/pr197719/test/aspects/MyAnnAspect.java b/tests/bugs161/pr197719/test/aspects/MyAnnAspect.java new file mode 100644 index 000000000..83a12e1c3 --- /dev/null +++ b/tests/bugs161/pr197719/test/aspects/MyAnnAspect.java @@ -0,0 +1,24 @@ +package test.aspects; + +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; + +@Aspect +public class MyAnnAspect { + + @Pointcut("call(@MyAnn * *(..))") + void validatedMethod() {} + + + @Around("validatedMethod()") + public Object validateMethodImpl(ProceedingJoinPoint thisJoinPoint) throws Throwable { + return doInvoke(thisJoinPoint); + } + + private Object doInvoke(final ProceedingJoinPoint thisJoinPoint) throws Throwable { + System.out.println("Invoking : " + thisJoinPoint+ " "+thisJoinPoint.getTarget().getClass().getName()); + return thisJoinPoint.proceed(); + } +} diff --git a/tests/bugs161/pr197719/test/aspects2/C2.java b/tests/bugs161/pr197719/test/aspects2/C2.java new file mode 100644 index 000000000..93361ba5e --- /dev/null +++ b/tests/bugs161/pr197719/test/aspects2/C2.java @@ -0,0 +1,34 @@ +package test.aspects2; + +import test.aspects.C1; + + +public class C2 extends C1 { + public void callAMethodC2() { + aMethod(); // Should be a marker here... + } + + public void innerClassCall() { + InnerClass ic = new InnerClass(); + + ic.foo(); + } + protected class InnerClass { + public void foo() { + aMethod(); // Should be a marker here... + } + } + + public static void main(String [] args) { + C1 c1 = new C1(); + + c1.callAMethod(); + + C2 c2 = new C2(); + + c2.aMethod(); // Should be a marker here... + c2.callAMethod(); + c2.callAMethodC2(); + c2.innerClassCall(); + } +} |