What i want to do is i have a class
class Automobile {
public void getEngine(int carNo,EngineClass engineClassObj){
System.out.println("EngineNo="+engineClassObj.sisNo);
}
}
Now when i load "Automobile" class in memory.
ilist = new InstructionList();
ilist.append(InstructionConstants.ALOAD_0);
ilist.append(new PUSH(pgen,345));
////Hear Now i have to also push the Object on Stack
ilist.append(ifact.createInvoke(_invoking_ClassName,
_invoking_MethodName, Type.INT,
new Type[] { Type.INT,Type.OBJECT }, Constants.INVOKEVIRTUAL));
ilist.append(InstructionConstants.IRETURN);
1-if i use createNew() method and generate new object then how i am going to
fill its fields value?
2-or if i firstly push all fields values of Engine type Obj on Stack using PUSH
then i can some how construct object on memory & then push it on Stack.
these are some solution i can think of.
so still need help...
________________________________
From: Martin von Gagern <[email protected]>
To: BCEL Users List <[email protected]>
Cc: Zaree Faryal <[email protected]>
Sent: Wed, June 8, 2011 11:24:24 AM
Subject: Re: How to push a Custom Type Object on Stack
On 08.06.2011 07:44, Zaree Faryal wrote:
> I know how to push Primitive Types on Stack using
> InstructinoList.append(new PUSH(ConstantPoolGen,343));
>
> Now i want to push Custom Type Object(Obj of some user defined class i.e.
>Engine
>
> Class obj) on Stack in BCEL.
Simply create the object; it will lie on the stack after creation until
you do something else with it. Or if you don't want to create it but
load it from some "static final" constant, then use GETSTATIC.
Martin