]> source.dussan.org Git - aspectj.git/commitdiff
Fix and test for PR90827: StackOverflow while weaving enum/annotation with Enum...
authoraclement <aclement>
Tue, 10 May 2005 15:09:03 +0000 (15:09 +0000)
committeraclement <aclement>
Tue, 10 May 2005 15:09:03 +0000 (15:09 +0000)
tests/bugs150/PR90827.aj [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java

diff --git a/tests/bugs150/PR90827.aj b/tests/bugs150/PR90827.aj
new file mode 100644 (file)
index 0000000..e7fd047
--- /dev/null
@@ -0,0 +1,6 @@
+// "enum called Enum, annotation called Annotation, etc"
+
+enum Enum {A,B,C}
+@interface Annotation {}
+aspect Aspect{}
+class Class{}
index cd5efbb3c2c894bf4e22f4e039a62319ba421953..1f9d16ca034d380d389f7df880c32139d4b4465f 100644 (file)
@@ -157,6 +157,10 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
          runTest("pertypewithin({interface}) illegal field modifier");
   }
   
+  public void testEnumCalledEnumEtc() {
+         runTest("enum called Enum, annotation called Annotation, etc");
+  }
+  
   // helper methods.....
   
   public SyntheticRepository createRepos(File cpentry) {
index b32ebc0c7a8d817f39fd7d453f07632dd6d7e213..cfd23c4ec9415055069b1a18c502a60ba7c6c220 100644 (file)
@@ -1033,24 +1033,25 @@ public class BcelWeaver implements IWeaver {
      * may choose to weave them in either order - but you'll probably have other problems if
      * you are supplying partial hierarchies like that !
      */
-    private void weaveParentsFor(List typesForWeaving,String typeToWeave) {
-        // Look at the supertype first
-       ResolvedTypeX rtx = world.resolve(typeToWeave);
-        ResolvedTypeX superType = rtx.getSuperclass();
-        if (superType!=null && typesForWeaving.contains(superType.getClassName())) {
-            weaveParentsFor(typesForWeaving,superType.getClassName());
-        }
-        
-        // Then look at the superinterface list
-        ResolvedTypeX[] interfaceTypes = rtx.getDeclaredInterfaces();
-        for (int i = 0; i < interfaceTypes.length; i++) {
-            ResolvedTypeX rtxI = interfaceTypes[i];
-            if (typesForWeaving.contains(rtxI.getClassName())) {
-                weaveParentsFor(typesForWeaving,rtxI.getClassName());
-            }
-        }
-        weaveParentTypeMungers(rtx); // Now do this type
-        typesForWeaving.remove(typeToWeave); // and remove it from the list of those to process
+          private void weaveParentsFor(List typesForWeaving,String typeToWeave) {
+                  // Look at the supertype first
+                  ResolvedTypeX rtx = world.resolve(typeToWeave);
+                  ResolvedTypeX superType = rtx.getSuperclass();
+                  
+                  if (superType!=null && typesForWeaving.contains(superType.getName())) {
+                    weaveParentsFor(typesForWeaving,superType.getName());
+                  }
+                        
+                  // Then look at the superinterface list
+                  ResolvedTypeX[] interfaceTypes = rtx.getDeclaredInterfaces();
+                  for (int i = 0; i < interfaceTypes.length; i++) {
+                    ResolvedTypeX rtxI = interfaceTypes[i];
+                    if (typesForWeaving.contains(rtxI.getName())) {
+                      weaveParentsFor(typesForWeaving,rtxI.getName());
+                    }
+                  }
+           weaveParentTypeMungers(rtx); // Now do this type
+           typesForWeaving.remove(typeToWeave); // and remove it from the list of those to process
     }
     
     public void prepareToProcessReweavableState() {