diff options
author | aclement <aclement> | 2011-08-05 16:17:39 +0000 |
---|---|---|
committer | aclement <aclement> | 2011-08-05 16:17:39 +0000 |
commit | 6ae463a7494a0e04878e2d265a3505dd0d32cc4a (patch) | |
tree | 224af0682d292083cc14073c27d353f398e84494 | |
parent | 7e88eedcce8fdf6b83134ed1bc0f7ea72781649e (diff) | |
download | aspectj-6ae463a7494a0e04878e2d265a3505dd0d32cc4a.tar.gz aspectj-6ae463a7494a0e04878e2d265a3505dd0d32cc4a.zip |
354022
-rw-r--r-- | weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java b/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java index eb8597925..8b0ec5ecf 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java @@ -495,7 +495,8 @@ class BcelClassWeaver implements IClassWeaver { // 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)) { + List<LazyMethodGen> recursiveCtors = new ArrayList<LazyMethodGen>(); + while (inlineSelfConstructors(methodGens, recursiveCtors)) { } positionAndImplement(initializationShadows); } @@ -1526,8 +1527,9 @@ class BcelClassWeaver implements IClassWeaver { return aspectsAffectingType; } - private boolean inlineSelfConstructors(List<LazyMethodGen> methodGens) { + private boolean inlineSelfConstructors(List<LazyMethodGen> methodGens, List<LazyMethodGen> recursiveCtors) { boolean inlinedSomething = false; + List<LazyMethodGen> newRecursiveCtors = new ArrayList<LazyMethodGen>(); for (LazyMethodGen methodGen : methodGens) { if (!methodGen.getName().equals("<init>")) { continue; @@ -1535,10 +1537,17 @@ class BcelClassWeaver implements IClassWeaver { InstructionHandle ih = findSuperOrThisCall(methodGen); if (ih != null && isThisCall(ih)) { LazyMethodGen donor = getCalledMethod(ih); - inlineMethod(donor, methodGen, ih); - inlinedSomething = true; + if (donor.equals(methodGen)) { + newRecursiveCtors.add(donor); + } else { + if (!recursiveCtors.contains(donor)) { + inlineMethod(donor, methodGen, ih); + inlinedSomething = true; + } + } } } + recursiveCtors.addAll(newRecursiveCtors); return inlinedSomething; } @@ -3094,7 +3103,7 @@ class BcelClassWeaver implements IClassWeaver { && s.charAt(4) == 'a' && (s.equals("org.aspectj.runtime.internal.CFlowCounter") || s.equals("org.aspectj.runtime.internal.CFlowStack") || s - .equals("org.aspectj.runtime.reflect.Factory"))) { + .equals("org.aspectj.runtime.reflect.Factory"))) { proceed = false; } else { if (methodName.equals("aspectOf")) { |