Skip to content

Commit

Permalink
Fix 443477: remove pre-init from cflow to avoid verify error on jdk 1…
Browse files Browse the repository at this point in the history
….7 later updates
  • Loading branch information
aclement committed Oct 7, 2014
1 parent c8e9512 commit 34cff60
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
5 changes: 4 additions & 1 deletion 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(..)) { }
}

6 changes: 3 additions & 3 deletions tests/src/org/aspectj/systemtest/ajc183/Ajc183Tests.java
Expand Up @@ -65,9 +65,9 @@ public void testAbstractAspectNPE_444398() {
runTest("abstract aspect npe");
}

// public void testVerifyError_443447() {
// runTest("verifyerror");
// }
public void testVerifyError_443447() {
runTest("verifyerror");
}
//
// public void testAnnoStyleDecp_442425() {
// runTest("anno style decp");
Expand Down
15 changes: 11 additions & 4 deletions weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
Expand Up @@ -2021,7 +2021,9 @@ public void weavePerTypeWithinAspectInitialization(final BcelAdvice munger, Unre

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();

Expand Down Expand Up @@ -2080,8 +2082,7 @@ public void weaveCflowEntry(final BcelAdvice munger, final Member cflowField) {
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();
Expand All @@ -2100,7 +2101,13 @@ public InstructionList getAdviceInstructions(BcelShadow s, BcelVar extraArgVar,
}
return exitInstructions;
}
});
};
// if (getKind() == PreInitialization) {
// weaveAfterReturning(exitAdvice);
// }
// else {
weaveAfter(exitAdvice);
// }

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

0 comments on commit 34cff60

Please sign in to comment.