Re: Re: Problem with generating method
Buu Vinh <[email protected]>
| Newsgroups | gmane.comp.java.objectweb.asm |
|---|---|
| Message-ID | <[email protected]> |
Please use [email protected] for ASM questions & answers. I assume that you mean mv.visitMethodInsn, not mv.visitFieldInsn --- On Mon, 3/21/11, Wojciech Tomasz Cichon <[email protected]> wrote: From: Wojciech Tomasz Cichon <[email protected]> Subject: Re: [asm] Re: Problem with generating method To: "Buu Vinh" <[email protected]> Date: Monday, March 21, 2011, 8:12 AM cheers, i just fixed that supposed to i want to call this method i tried this: mv.visitInsn(Opcodes.ICONST_2); mv.visitInsn(Opcodes.ICONST_4); mv.visitFieldInsn (Opcodes.INVOKESTATIC, className, name , "(II)I"); and it returns me an error: f has illigal signature “(II)I” can you tell me how i can fix that? regards From: Buu Vinh Sent: Monday, March 21, 2011 12:54 PM To: [email protected] ; [email protected] Subject: [asm] Re: Problem with generating method Your method descriptor indicates that the return type is an integer "(II)I", therefore your return should be IRETURN. --- On Mon, 3/21/11, [email protected] <[email protected]> wrote: From: [email protected] <[email protected]> Subject: [asm] Problem with generating method To: [email protected] Date: Monday, March 21, 2011, 6:49 AM i succeded in creating main method, and constructor but now i need to create new static method suppose i want do method: static public f(int x, int y) { return x*y; } based on my experience with other methods i wrote: mv = cw.visitMethod( Opcodes.ACC_PUBLIC+Opcodes.ACC_STATIC, f,"(II)I",null,null); mv.visitCode(); mv.visitVarInsn(Opcodes.ILOAD, 0); mv.visitVarInsn(Opcodes.ILOAD, 1); mv.visitInsn(Opcodes.IMUL); mv.visitInsn(Opcodes.RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); disassebled code for this method is looks exactly as that one created from source code bur when i try run class (without using that method) a get (class: myClass, method: f signature (II)I) Wrong return type in function can somebody tells me whad did i miss regards -----Inline Attachment Follows----- -- You receive this message as a subscriber of the wlmailhtml:/mc/[email protected] mailing list. To unsubscribe: mailto:wlmailhtml:/mc/[email protected] For general help: mailto:wlmailhtml:/mc/[email protected]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws -- You receive this message as a subscriber of the [email protected] mailing list. To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws
message-footer.txt
(text/plain, 238 B)
-- You receive this message as a subscriber of the [email protected] mailing list. To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws