Just thought I should give this some closure. Following Eriks instructions and looking up the jvm spec I realised that InstructionsFactory.createNewArray doesnt do the whole job. It expects the length of the array to be on the stack. Simple really. Seriously though lads ... BCEL is desperately in need of some proper documentation if its ever going to achieve its potential. Am I alone in feeling that this should be one of, if not the, priority for its maintainers/developers (easy to say I know when youre not one of them!)?
Best of luck, Alan ----- Original Message ----- From: "Erik Corry" <[EMAIL PROTECTED]> To: "BCEL Users List" <[EMAIL PROTECTED]> Sent: Wednesday, January 14, 2004 9:00 PM Subject: Re: Help inserting instructions - simple question > On Wed, Jan 14, 2004 at 08:33:48PM -0000, Al wrote: > > Will somone please take a quick look at the example below. I am trying to modify each method in a class s.t. the first thing it does is allocate a new byte[] (for the moment Im happy to just create it and let it go, ... I mean I dont need to bind it to anything). I dont understand what more I am supposed to do to insert instructions in a method. This code will result in an error like - > > > > Exception in thread "main" java.lang.VerifyError: (class: tests/test1/Test, method: main signature: ([Ljava/lang/String;)V) Unable to pop operand off an empty stack > > Probably the best thing is to run either > > java org.apache.bcel.util.Class2HTML mymodifiedclassfile.class > > or > > java org.apache.bcel.verifier.Verifier mymodifiedclassfile.class > > and look at the output until you can see where you are getting a stack > underflow. > > -- > Erik Corry I'd be a Libertarian, if they weren't all a > [EMAIL PROTECTED] bunch of tax-dodging professional whiners. - B. Breathed. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
