From 34cff6034e44295417149fdb85dd2cebac8c983f Mon Sep 17 00:00:00 2001 From: Andy Clement Date: Tue, 7 Oct 2014 15:07:00 -0700 Subject: [PATCH] Fix 443477: remove pre-init from cflow to avoid verify error on jdk 1.7 later updates --- tests/bugs183/443477/Coo.java | 5 ++++- .../aspectj/systemtest/ajc183/Ajc183Tests.java | 6 +++--- .../src/org/aspectj/weaver/bcel/BcelShadow.java | 15 +++++++++++---- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/tests/bugs183/443477/Coo.java b/tests/bugs183/443477/Coo.java index 7b514f3ba..3362f5024 100644 --- a/tests/bugs183/443477/Coo.java +++ b/tests/bugs183/443477/Coo.java @@ -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(..)) { } } diff --git a/tests/src/org/aspectj/systemtest/ajc183/Ajc183Tests.java b/tests/src/org/aspectj/systemtest/ajc183/Ajc183Tests.java index 412fc00eb..8f1a6ccac 100644 --- a/tests/src/org/aspectj/systemtest/ajc183/Ajc183Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc183/Ajc183Tests.java @@ -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"); diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java b/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java index 8c51e0f49..e6676900f 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java @@ -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); } -- 2.39.5