Unexpected (for me) output when injecting new instructions

<[email protected]> Thu, 23 Nov 2017 18:00:54 +0100 (CET)
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
TLDR I built my own java bytecode modification framework for a project,
however I'm exploring ObjectWeb because it seems like an overall better
solution.

So I built a simple test, inject some junk, and didn't get what I expected
back.

I have a simple method to return true
public static boolean isTurkeyDay() {
    iconst_1
    ireturn
}

As a test I want to inject a nop after the ireturn

        public void visitInsn(int opcode) {
            switch (opcode) {
                case Opcodes.IRETURN:
                    mv.visitInsn(Opcodes.IRETURN);
                    mv.visitInsn(Opcodes.NOP);
                    break;
                default:
                    super.visitInsn(opcode);
            }

I expect:
public static boolean isTurkeyDay() {
    iconst_1
    ireturn
    nop
}

However I get

public static boolean isTurkeyDay() {
    iconst_1
    ireturn
    athrow
}

What am I missing here?

Thank you for this


-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws