I'm fairly new to Java bytecode. I'm using BCEL to generate bytecode, but I get an error message when I try to use the generated code. (In hindsight, it looks like ObjectWeb ASM is more advanced and more commonly used than BCEL.)
Here is the error message:
Exception in thread "main" java.lang.VerifyError:
(class: cb/io/FileDescriptor, method: set
signature: (I)J)
Stack size too large
Here is the method:
// Method descriptor #4 (I)J
// Stack: 0, Locals: 1
private static long set(int arg1);
0 lconst_0
1 lreturn
Local variable table:
[pc: 0, pc: 2] local: arg1 index: 0 type: int
From what I understand, the local variable table is correct because it matches the input parameter. I haven't added a 'this' variable because the method is static.
If I'm not mistaken, lconst_0 loads a long value of 0 onto the stack, and lreturn consumes that value and returns it.
What am I doing wrong? Is there enough information here to tell?
Thanks!