1 Reply Latest reply on Aug 28, 2009 3:38 AM by Ales Justin

    Adding vargargs parameters to getXXXDeclaredXXX methods at J

    Flavia Rainone Master

      This post is related to issue JBREFLECT-53.

      As result of implementing JBREFLECT-53, I noticed that MutableClassInfo now has two similar getDeclaredMethod methods:

      MutableMethodInfo getDeclaredMethod(String name, TypeInfo... parameters);
      MutableMethodInfo getDeclaredMethod(String name, String... parameters)
      


      Now, if I try to call getDeclaredMethod with one parameter like the piece of code below:
      MutableClassInfo mci = ....
      mci.getDeclaredMethod("bar");

      I get the error:
      The method getDeclaredMethod(String, TypeInfo[]) is ambiguous for the type MutableClassInfo


      So, this forces us to use getDeclaredMethod with a minimum of two parameters, taking away some of the advantage of having a signature with vargars:
      mci.getDeclaredMethod("bar", new TypeInfo[0]);


      Would it be all right if I added a third method to MutableClassInfo (see below), so I can get rid of the problem?
      MutableMethodInfo getDeclaredMethod(String name)


      My main concern is whether there could be other classes outside of JBoss Reflection project implementing MutableClassInfo interface.