--- /dev/null
+package test.aspects;
+
+
+public class C1 {
+
+ @MyAnn
+ protected void aMethod() {
+ System.out.println("Calling aMethod");
+ }
+
+ public void callAMethod() {
+ aMethod(); // Should be a marker here...
+ }
+
+}
--- /dev/null
+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();
+ }
+}
--- /dev/null
+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 {
+}
--- /dev/null
+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();
+ }
+}
--- /dev/null
+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();
+ }
+}
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");}
<!-- 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">