aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2005-05-10 15:09:03 +0000
committeraclement <aclement>2005-05-10 15:09:03 +0000
commit2c4f9d292a521703642169d8c066792d0e0802f5 (patch)
tree0938336b35c14cd8a79c24c4d5bf0d52500be9f2
parentf6034581d8540124494806a7c6b3ad37ead2b6c3 (diff)
downloadaspectj-2c4f9d292a521703642169d8c066792d0e0802f5.tar.gz
aspectj-2c4f9d292a521703642169d8c066792d0e0802f5.zip
Fix and test for PR90827: StackOverflow while weaving enum/annotation with Enum/Annotation name (Patch from Andrew Huff)
-rw-r--r--tests/bugs150/PR90827.aj6
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java4
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java37
3 files changed, 29 insertions, 18 deletions
diff --git a/tests/bugs150/PR90827.aj b/tests/bugs150/PR90827.aj
new file mode 100644
index 000000000..e7fd047cc
--- /dev/null
+++ b/tests/bugs150/PR90827.aj
@@ -0,0 +1,6 @@
+// "enum called Enum, annotation called Annotation, etc"
+
+enum Enum {A,B,C}
+@interface Annotation {}
+aspect Aspect{}
+class Class{}
diff --git a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
index cd5efbb3c..1f9d16ca0 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
@@ -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) {
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
index b32ebc0c7..cfd23c4ec 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
@@ -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() {