zaree
zaree

Reputation: 641

How to push integer on Stack in BCEL

I am facing a problem in context of pushing a integer on stack in BCEL. I have a method _square of someClass 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));

thanks

Upvotes: 3

Views: 604

Answers (1)

zaree
zaree

Reputation: 641

I use

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

the push method use to push primitive type data on stack.

Upvotes: 1

Related Questions