Incompatible object argument for function call

Rajaraman Santhanam <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <12c4fc17888.-8290978123093982695.4436921197351575993@zohocorp.com>
Hi,

Am here again on some issue. Getting this error "Incompatible object argument for function call"


Here is what I'm trying to do. On method entry, I call a method to pass on the method details &amp; parameters.

        Label startLabel = new Label(); Label endLabel = new Label(); Label exceptionLabel = new Label(); mv.visitTryCatchBlock(startLabel, endLabel, exceptionLabel, "java/lang/Throwable"); mv.visitLabel(startLabel); mv.visitMethodInsn(INVOKESTATIC, "test/MyClass", "getInstance", "()Ltest/MyClass;"); mv.visitLdcInsn(tracerName); mv.visitLdcInsn(className); mv.visitLdcInsn(methodName); mv.visitLdcInsn(methodDesc); loadArgArray(); mv.visitMethodInsn(INVOKEVIRTUAL, "test/MyClass", "invoke", method_desc); mv.visitLabel(endLabel); Label doneLabel = new Label(); mv.visitJumpInsn(GOTO, doneLabel); mv.visitLabel(exceptionLabel); mv.visitFrame(Opcodes.F_SAME1, 0, null, 1, new Object[] { "java/lang/Exception" }); mv.visitVarInsn(ASTORE, 1); mv.visitVarInsn(ALOAD, 1); mv.visitMethodInsn(INVOKEVIRTUAL
 , "java/lang/Throwable", "printStackTrace", "()V"); mv.visitLabel(doneLabel); 

In on method exit:


 try { if(opcode != ATHROW) { onFinally(opcode); } } catch(Exception ex) { ex.printStackTrace(); }


private void onFinally(int opcode) { Label doneLabel = new Label(); if(opcode == ATHROW) { dup();     Type eType = Type.getType(Throwable.class); int exception = newLocal(eType); storeLocal(exception, eType); mv.visitMethodInsn(INVOKESTATIC, "test/MyClass", "getInstance", "()Ltest/MyClass;"); loadLocal(exception); mv.visitMethodInsn(INVOKEVIRTUAL, "test/MyClass", "finish", "(Ljava/lang/Throwable;)V"); } else { Type returnType = Type.getReturnType(methodDesc);
            Type objectType = Type.getObjectType("java/lang/Object"); int returnVar = -1; if(opcode != RETURN) { if(opcode == LRETURN || opcode == DRETURN) { dup2(); } else { dup(); } loadReturnValue(returnType); //this loads the primitive return value as object in the top of the operand stack returnVar = newLocal(returnType); storeLocal(returnVar, returnType); box(objectType); } mv.visitMethodInsn(INVOKESTATIC, "test/MyClass", "getInstance", "()Ltest/MyClass;"); mv.visitIntInsn(SIPUSH, opcode); if(opcode == RETURN) { mv.visitInsn(ACONST_NULL); } else { loadLocal(returnVar); } mv.visitMethodInsn(INVOKEVIRTUAL, "test/MyClass", "finish", "(ILjava/lang/Object;)V"); } visitLabel(doneLabel); }

I know I'm missing something here. I tried hard but in vain. 


Any help is much appreciated.


Thanks,
ramanr
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.