aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2006-07-28 14:05:39 +0000
committeraclement <aclement>2006-07-28 14:05:39 +0000
commitaf9e8ba799feb154ffbd40c190b42f6b01ec3109 (patch)
tree40ec7a0b2bc9734b930b95662c6f5066db9e26d5
parent68c36e3ac9b5fc031a956800158aee15b0d44301 (diff)
downloadaspectj-af9e8ba799feb154ffbd40c190b42f6b01ec3109.tar.gz
aspectj-af9e8ba799feb154ffbd40c190b42f6b01ec3109.zip
pipeline changes: fix for deep nesting aspects
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/AjPipeliningCompilerAdapter.java13
-rw-r--r--tests/features153/pipelining/DeepAspect.java8
-rw-r--r--tests/src/org/aspectj/systemtest/ajc153/PipeliningTests.java1
-rw-r--r--tests/src/org/aspectj/systemtest/ajc153/ajc153.xml8
-rw-r--r--tests/src/org/aspectj/systemtest/ajc153/pipelining.xml8
5 files changed, 31 insertions, 7 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/AjPipeliningCompilerAdapter.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/AjPipeliningCompilerAdapter.java
index 024be56a1..0f37c5f2f 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/AjPipeliningCompilerAdapter.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/AjPipeliningCompilerAdapter.java
@@ -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) {
diff --git a/tests/features153/pipelining/DeepAspect.java b/tests/features153/pipelining/DeepAspect.java
new file mode 100644
index 000000000..b767ed213
--- /dev/null
+++ b/tests/features153/pipelining/DeepAspect.java
@@ -0,0 +1,8 @@
+public class DeepAspect {
+ static class Inner {
+ static aspect SimpleAspect {
+ before(): staticinitialization(Cl*) {
+ }
+ }
+ }
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc153/PipeliningTests.java b/tests/src/org/aspectj/systemtest/ajc153/PipeliningTests.java
index 01e9430bc..1e93e7740 100644
--- a/tests/src/org/aspectj/systemtest/ajc153/PipeliningTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc153/PipeliningTests.java
@@ -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"); }
diff --git a/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml b/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml
index 83e57e87f..46b3db42a 100644
--- a/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml
+++ b/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml
@@ -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>
diff --git a/tests/src/org/aspectj/systemtest/ajc153/pipelining.xml b/tests/src/org/aspectj/systemtest/ajc153/pipelining.xml
index 409327ab7..05b85d1f8 100644
--- a/tests/src/org/aspectj/systemtest/ajc153/pipelining.xml
+++ b/tests/src/org/aspectj/systemtest/ajc153/pipelining.xml
@@ -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> \ No newline at end of file