On 09.06.2011 08:38, Zaree Faryal wrote:
> 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.

I suggest you formulate how you'd create the object in Java, and then
simply run the resulting class through BCELifier to get an idea of how
the corresponding BCEL code would look like.

http://jakarta.apache.org/bcel/apidocs/org/apache/bcel/util/BCELifier.html

Martin

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to