Browse Source

Fix 443477: remove pre-init from cflow to avoid verify error on jdk 1.7 later updates

tags/V1_8_3
Andy Clement 9 years ago
parent
commit
34cff6034e

+ 4
- 1
tests/bugs183/443477/Coo.java View File

@@ -1,12 +1,15 @@
public class Coo {
Coo() {
}

int i = 4;
public static void main(String[] args) {
}
}

aspect Azpect {
before(): !cflow(preinitialization(Coo.new(..))) && execution(* main(..)) { }
before(): !cflow(preinitialization(Coo.new(..))) && execution(* main(..)) { }
}


+ 3
- 3
tests/src/org/aspectj/systemtest/ajc183/Ajc183Tests.java View File

@@ -65,9 +65,9 @@ public class Ajc183Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
runTest("abstract aspect npe");
}
// public void testVerifyError_443447() {
// runTest("verifyerror");
// }
public void testVerifyError_443447() {
runTest("verifyerror");
}
//
// public void testAnnoStyleDecp_442425() {
// runTest("anno style decp");

+ 11
- 4
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java View File

@@ -2021,7 +2021,9 @@ public class BcelShadow extends Shadow {

public void weaveCflowEntry(final BcelAdvice munger, final Member cflowField) {
final boolean isPer = munger.getKind() == AdviceKind.PerCflowBelowEntry || munger.getKind() == AdviceKind.PerCflowEntry;

if (!isPer && getKind() == PreInitialization) {
return;
}
final Type objectArrayType = new ArrayType(Type.OBJECT, 1);
final InstructionFactory fact = getFactory();

@@ -2080,8 +2082,7 @@ public class BcelShadow extends Shadow {
entryInstructions.append(entrySuccessInstructions);
}

// this is the same for both per and non-per
weaveAfter(new BcelAdvice(null, null, null, 0, 0, 0, null, munger.getConcreteAspect()) {
BcelAdvice exitAdvice = new BcelAdvice(null, null, null, 0, 0, 0, null, munger.getConcreteAspect()) {
@Override
public InstructionList getAdviceInstructions(BcelShadow s, BcelVar extraArgVar, InstructionHandle ifNoAdvice) {
InstructionList exitInstructions = new InstructionList();
@@ -2100,7 +2101,13 @@ public class BcelShadow extends Shadow {
}
return exitInstructions;
}
});
};
// if (getKind() == PreInitialization) {
// weaveAfterReturning(exitAdvice);
// }
// else {
weaveAfter(exitAdvice);
// }

range.insert(entryInstructions, Range.InsideBefore);
}

Loading…
Cancel
Save