diff options
author | aclement <aclement> | 2004-08-17 14:04:29 +0000 |
---|---|---|
committer | aclement <aclement> | 2004-08-17 14:04:29 +0000 |
commit | 84e4e53608871ab3ad0381d19abd8fa2e1bc4533 (patch) | |
tree | 1c22d44c9207d48ebba4539bd74bb03db9018e8e /weaver | |
parent | 0e52e76e3ea893f5f553419924cba8aebad29be4 (diff) | |
download | aspectj-84e4e53608871ab3ad0381d19abd8fa2e1bc4533.tar.gz aspectj-84e4e53608871ab3ad0381d19abd8fa2e1bc4533.zip |
Test and fix for Bugzilla Bug 62642
proper handling of ExceptionInIntializer inside <clinit> in presence of after throwing advice
Diffstat (limited to 'weaver')
-rw-r--r-- | weaver/src/org/aspectj/weaver/bcel/BcelShadow.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java b/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java index 743453592..9e6fd0c29 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java @@ -1201,6 +1201,24 @@ public class BcelShadow extends Shadow { BcelVar exceptionVar = genTempVar(catchType); exceptionVar.appendStore(handler, fact); + // pr62642 + // I will now jump through some firey BCEL hoops to generate a trivial bit of code: + // if (exc instanceof ExceptionInInitializerError) + // throw (ExceptionInInitializerError)exc; + if (this.getEnclosingMethod().getName().equals("<clinit>")) { + ResolvedTypeX eiieType = world.resolve("java.lang.ExceptionInInitializerError"); + ObjectType eiieBcelType = (ObjectType)BcelWorld.makeBcelType(eiieType); + InstructionList ih = new InstructionList(InstructionConstants.NOP); + handler.append(exceptionVar.createLoad(fact)); + handler.append(fact.createInstanceOf(eiieBcelType)); + BranchInstruction bi = + InstructionFactory.createBranchInstruction(Constants.IFEQ,ih.getStart()); + handler.append(bi); + handler.append(exceptionVar.createLoad(fact)); + handler.append(fact.createCheckCast(eiieBcelType)); + handler.append(InstructionConstants.ATHROW); + handler.append(ih); + } InstructionList endHandler = new InstructionList( exceptionVar.createLoad(fact)); |