summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2004-05-12 12:52:55 +0000
committeraclement <aclement>2004-05-12 12:52:55 +0000
commitb9ec4df1259123c4cccc09f5a8b0549b412ee071 (patch)
tree94155f852caa38fd572d987beb3527b6e6563d9a
parent4b65e3caf070cb578b8db8fae331e990d9dfee27 (diff)
downloadaspectj-b9ec4df1259123c4cccc09f5a8b0549b412ee071.tar.gz
aspectj-b9ec4df1259123c4cccc09f5a8b0549b412ee071.zip
Fix for Bugzilla Bug 61538
nested uses of this() inside constructors not handled properly for initialization and preinitialization pointcuts
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java b/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
index 1c3b93be0..2a487d008 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
@@ -360,7 +360,10 @@ class BcelClassWeaver implements IClassWeaver {
// if we matched any initialization shadows, we inline and weave
if (! initializationShadows.isEmpty()) {
- inlineSelfConstructors(methodGens);
+ // Repeat next step until nothing left to inline...cant go on
+ // infinetly as compiler will have detected and reported
+ // "Recursive constructor invocation"
+ while (inlineSelfConstructors(methodGens));
positionAndImplement(initializationShadows);
}
@@ -402,7 +405,8 @@ class BcelClassWeaver implements IClassWeaver {
}
- private void inlineSelfConstructors(List methodGens) {
+ private boolean inlineSelfConstructors(List methodGens) {
+ boolean inlinedSomething = false;
for (Iterator i = methodGens.iterator(); i.hasNext();) {
LazyMethodGen mg = (LazyMethodGen) i.next();
if (! mg.getName().equals("<init>")) continue;
@@ -410,8 +414,10 @@ class BcelClassWeaver implements IClassWeaver {
if (ih != null && isThisCall(ih)) {
LazyMethodGen donor = getCalledMethod(ih);
inlineMethod(donor, mg, ih);
+ inlinedSomething = true;
}
}
+ return inlinedSomething;
}
private void positionAndImplement(List initializationShadows) {