if (declaration.memberTypes!=null) {
TypeDeclaration[] memberTypes = declaration.memberTypes;
for (int j = 0; j < memberTypes.length; j++) { // loop through inner types
- if (isAspect(memberTypes[j])) return true;
+ if (containsAnAspect(memberTypes[j])) return true;
}
}
}
}
return false;
}
+
+ private boolean containsAnAspect(TypeDeclaration tDecl) {
+ if (isAspect(tDecl)) return true;
+ if (tDecl.memberTypes!=null) {
+ TypeDeclaration[] memberTypes = tDecl.memberTypes;
+ for (int j = 0; j < memberTypes.length; j++) { // loop through inner types
+ if (containsAnAspect(memberTypes[j])) return true;
+ }
+ }
+ return false;
+ }
private static final char[] aspectSig = "Lorg/aspectj/lang/annotation/Aspect;".toCharArray();
private boolean isAspect(TypeDeclaration declaration) {
--- /dev/null
+public class DeepAspect {
+ static class Inner {
+ static aspect SimpleAspect {
+ before(): staticinitialization(Cl*) {
+ }
+ }
+ }
+}
public void testBuildOneAspectTwoClasses() { runTest("build one aspect and two classes");}
public void testBuildTwoClassesOneAspect() { runTest("build two classes and one aspect");}
public void testBuildTwoAspects() { runTest("build two aspects");}
+ public void testBuildClassAndNestedAspect() { runTest("build one class and deeply nested aspect");}
public void testAspectExtendsClass() { runTest("aspect extends class"); }
<compile files="hello/HelloWorld.java hello/ThrowExceptionBefore.aj"/>
<run class="hello.HelloWorld">
<stderr>
-<!--
<line text="hello.HelloWorld.println(HelloWorld.java:13)"/>
--->
- <line text="hello.HelloWorld.println(HelloWorld.java)"/>
+ <!--line text="hello.HelloWorld.println(HelloWorld.java)"/-->
<line text="hello.HelloWorld.testStackTrace(HelloWorld.java:19)"/>
<line text="hello.HelloWorld.main(HelloWorld.java:41)"/>
</stderr>
<compile files="hello/HelloWorld.java hello/ThrowExceptionAround.aj" options="-XnoInline"/>
<run class="hello.HelloWorld">
<stderr>
-<!--
<line text="hello.HelloWorld.println(HelloWorld.java:13)"/>
--->
- <line text="hello.HelloWorld.println(HelloWorld.java:1)"/>
+ <!--line text="hello.HelloWorld.println(HelloWorld.java:1)"/-->
<line text="hello.HelloWorld.testStackTrace(HelloWorld.java:19)"/>
<line text="hello.HelloWorld.main(HelloWorld.java:41)"/>
</stderr>
<ajc-test dir="features153/pipelining" title="recognizing annotation style aspects - 2">
<compile files="ClassOne.java,AtInnerAJAspect.java" options="-1.5 -verbose"/>
</ajc-test>
+
+ <!-- the aspect is multiple layers down in the class... -->
+ <ajc-test dir="features153/pipelining" title="build one class and deeply nested aspect">
+ <compile files="ClassOne.java,DeepAspect.java" options="-1.5 -verbose -showWeaveInfo">
+ <message kind="weave" text="Join point 'staticinitialization(void ClassOne.<clinit>())' in Type 'ClassOne' (ClassOne.java:1) advised by before advice from 'DeepAspect$Inner$SimpleAspect' (DeepAspect.java:4)"/>
+ </compile>
+ </ajc-test>
+
</suite>
\ No newline at end of file