Browse Source

354022

tags/V1_6_12M2
aclement 12 years ago
parent
commit
6ae463a749
1 changed files with 14 additions and 5 deletions
  1. 14
    5
      weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java

+ 14
- 5
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java View File

@@ -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")) {

Loading…
Cancel
Save