From 6f69422b5b935c1fbaf73dc8768e41c85991d1ae Mon Sep 17 00:00:00 2001 From: jhugunin Date: Tue, 27 May 2003 18:30:16 +0000 Subject: [PATCH] slightly better error messages for Bugzilla Bug 38168 insertion of lots of advice code can make branch offset for if too large --- .../org/aspectj/weaver/bcel/LazyMethodGen.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java b/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java index 9c7f3dc42..f5d87a3e7 100644 --- a/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java +++ b/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java @@ -33,6 +33,7 @@ import org.apache.bcel.classfile.Method; import org.apache.bcel.generic.BranchHandle; import org.apache.bcel.generic.BranchInstruction; import org.apache.bcel.generic.CPInstruction; +import org.apache.bcel.generic.ClassGenException; import org.apache.bcel.generic.CodeExceptionGen; import org.apache.bcel.generic.Instruction; import org.apache.bcel.generic.InstructionHandle; @@ -45,6 +46,7 @@ import org.apache.bcel.generic.MethodGen; import org.apache.bcel.generic.ObjectType; import org.apache.bcel.generic.Select; import org.apache.bcel.generic.Type; +import org.aspectj.bridge.IMessage; import org.aspectj.weaver.AjAttribute; import org.aspectj.weaver.BCException; import org.aspectj.weaver.ISourceContext; @@ -278,8 +280,17 @@ public final class LazyMethodGen { } public Method getMethod() { - MethodGen gen = pack(); - return gen.getMethod(); + try { + MethodGen gen = pack(); + return gen.getMethod(); + } catch (ClassGenException e) { + enclosingClass.getBcelObjectType().getResolvedTypeX().getWorld().showMessage( + IMessage.ERROR, "problem generating method " + + this.getClassName() + "." + this.getName() + ": " + e.getMessage(), + this.getMemberView() == null ? null : this.getMemberView().getSourceLocation(), null); + throw e; + } + } // ============================= -- 2.39.5