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

    Adding vargargs parameters to getXXXDeclaredXXX methods at J

    flavia.rainone

      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.

        • 1. Re: Adding vargargs parameters to getXXXDeclaredXXX methods
          alesj

           

          "flavia.rainone@jboss.com" wrote:

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

          If this fixes your problem, sure.

          "flavia.rainone@jboss.com" wrote:

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

          I doubt they do, as this was never properly finished.
          (only a mad man would do this :-)

          And even if they do, we're changing the version to indicate that there were api changes,
          hence users can either change their code or stick with the old one.