Re: Problem with generating method

Buu Vinh <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
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 [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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.