Method.getMethod for varargs?

<[email protected]> Thu, 30 Nov 2017 10:20:29 +0100 (CET)
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
Hi,

I'm new to using ASM and I'm trying to look up some method with varargs and I
don't understand how to format the string input to getMethod to match the
actual signature.

I'm calling getMethod like this:
        method = Method.getMethod(stringArg);

The method I want to inspect is declared in the code as:
  void log(Foo foo, Object... bar);

When I pass in "stringArg" as
   void log(mypackagage/Foo, [java/lang/Object)
I get back a Method where getDescriptor() returns this
   (Lmypackage/Foo;[Ljava/lang/Object;)V

If I make a MethodVisitor and look how the "desc" argument in the
visitMethodInsn(int opcode, String owner, String name, String desc, boolean
itf) looks like when visiting the "log" method, "desc"  looks like this:
   (Lmypackage/Foo;L[java/lang/Object;)V

That is, the former has "[L" and the latter has "L[" for the varargs; I'm
obviously doing this wrong.

I've tried calling getMethod with the bracket at the end:
   void log(mypackagage/Foo, java/lang/Object[)
and then my method gets the signature
  (Lmypackage/Foo;Ljava/lang/Object[;)V
Which still isn't a match with what I see in the visitor.

So what should I pass in to get the description with "L["?

TIA,
  Chris


-- 
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