How to click integer on Stack in BCEL

I ran into a problem in the context of pushing an integer onto the stack in BCEL . I have a _square someClass method , i.e. mathClass "

    ilist = new InstructionList();
    ilist.append(InstructionConstants.ALOAD_0);
    ilist.append(new GETFIELD(findex));
   //I am trying to push some value using createLoad but it is not working 

     ilist.append(InstructionConstants.ALOAD_1);
    ilist.append(ifact.createInvoke("mathClass", _square, Type.INT,
       new Type[] { Type.INT }, Constants.INVOKEVIRTUAL));

thank

+3
source share
1 answer

I use

new InstructionList.append(new PUSH(constantPool,23));

The push method uses to push data of a primitive type onto the stack.

+1
source

All Articles