aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/bugs161/pr197719/test/aspects/C1.java15
-rw-r--r--tests/bugs161/pr197719/test/aspects/C3.java42
-rw-r--r--tests/bugs161/pr197719/test/aspects/MyAnn.java13
-rw-r--r--tests/bugs161/pr197719/test/aspects/MyAnnAspect.java24
-rw-r--r--tests/bugs161/pr197719/test/aspects2/C2.java34
-rw-r--r--tests/src/org/aspectj/systemtest/ajc161/Ajc161Tests.java1
-rw-r--r--tests/src/org/aspectj/systemtest/ajc161/ajc161.xml21
7 files changed, 150 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();
+ }
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc161/Ajc161Tests.java b/tests/src/org/aspectj/systemtest/ajc161/Ajc161Tests.java
index ed8cd9f32..04551984b 100644
--- a/tests/src/org/aspectj/systemtest/ajc161/Ajc161Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc161/Ajc161Tests.java
@@ -23,6 +23,7 @@ import org.aspectj.testing.XMLBasedAjcTestCase;
public class Ajc161Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
// AspectJ1.6.1
+ public void testProtectedMethodsAroundAdvice_pr197719_2() { runTest("protected methods and around advice - again - 2");}
public void testProtectedMethodsAroundAdvice_pr197719() { runTest("protected methods and around advice - again");}
public void testProtectedMethodsAroundAdvice_pr230075() { runTest("protected methods and around advice");}
public void testFinalStringsAnnotationPointcut_pr174385() { runTest("static strings in annotation pointcuts");}
diff --git a/tests/src/org/aspectj/systemtest/ajc161/ajc161.xml b/tests/src/org/aspectj/systemtest/ajc161/ajc161.xml
index 0265aa7d7..59838531e 100644
--- a/tests/src/org/aspectj/systemtest/ajc161/ajc161.xml
+++ b/tests/src/org/aspectj/systemtest/ajc161/ajc161.xml
@@ -3,6 +3,27 @@
<!-- AspectJ v1.6.1 Tests -->
<suite>
+ <ajc-test dir="bugs161/pr197719" title="protected methods and around advice - again - 2">
+ <compile files="test/aspects/C1.java test/aspects/C3.java test/aspects/MyAnn.java test/aspects/MyAnnAspect.java test/aspects2/C2.java" options="-1.5 -showWeaveInfo">
+ <message kind="weave" text="Join point 'method-call(void test.aspects.C1.aMethod())' in Type 'test.aspects.C1' (C1.java:12) "/>
+
+ <!-- first of these through accessor - so line number wrong and target wrong -->
+ <message kind="weave" text="Join point 'method-call(void test.aspects.C1.aMethod())' in Type 'test.aspects2.C2' (C2.java:1) "/><!-- was line 18 -->
+ <message kind="weave" text="Join point 'method-call(void test.aspects2.C2.aMethod())' in Type 'test.aspects2.C2' (C2.java:8) "/>
+ <message kind="weave" text="Join point 'method-call(void test.aspects2.C2.aMethod())' in Type 'test.aspects2.C2' (C2.java:29) "/>
+
+ <message kind="weave" text="Join point 'method-call(void test.aspects.C1.aMethod())' in Type 'test.aspects.C3' (C3.java:10) "/>
+ <message kind="weave" text="Join point 'method-call(void test.aspects2.C2.aMethod())' in Type 'test.aspects.C3' (C3.java:13) "/>
+ <message kind="weave" text="Join point 'method-call(void test.aspects.C1.aMethod())' in Type 'test.aspects.C3$InnerClass' (C3.java:24) "/>
+ <message kind="weave" text="Join point 'method-call(void test.aspects2.C2.aMethod())' in Type 'test.aspects.C3$InnerClass' (C3.java:27) "/>
+ <message kind="weave" text="Join point 'method-call(void test.aspects.C1.aMethod())' in Type 'test.aspects.C3' (C3.java:34) "/>
+
+ </compile>
+
+ <run class="test.aspects.C3">
+ </run>
+ </ajc-test>
+
<ajc-test dir="bugs161/pr197719" title="protected methods and around advice - again">
<compile files="A.java B.java X.java" options="-1.5"/>
<run class="b.B">