Browse Source

pipeline changes: fix for deep nesting aspects

tags/pre_pr_153572
aclement 18 years ago
parent
commit
af9e8ba799

+ 12
- 1
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/AjPipeliningCompilerAdapter.java View File

@@ -539,13 +539,24 @@ public class AjPipeliningCompilerAdapter extends AbstractCompilerAdapter {
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) {

+ 8
- 0
tests/features153/pipelining/DeepAspect.java View File

@@ -0,0 +1,8 @@
public class DeepAspect {
static class Inner {
static aspect SimpleAspect {
before(): staticinitialization(Cl*) {
}
}
}
}

+ 1
- 0
tests/src/org/aspectj/systemtest/ajc153/PipeliningTests.java View File

@@ -44,6 +44,7 @@ public class PipeliningTests extends org.aspectj.testing.XMLBasedAjcTestCase {
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"); }

+ 2
- 6
tests/src/org/aspectj/systemtest/ajc153/ajc153.xml View File

@@ -119,10 +119,8 @@
<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>
@@ -144,10 +142,8 @@
<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>

+ 8
- 0
tests/src/org/aspectj/systemtest/ajc153/pipelining.xml View File

@@ -60,5 +60,13 @@
<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.&lt;clinit&gt;())' in Type 'ClassOne' (ClassOne.java:1) advised by before advice from 'DeepAspect$Inner$SimpleAspect' (DeepAspect.java:4)"/>
</compile>
</ajc-test>

</suite>

Loading…
Cancel
Save