groovy
  1. groovy
  2. GROOVY-5161

MetaObjectProtocol.getMetaMethod doc for "args" is ambiguous

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: 1.8.4
    • Fix Version/s: 1.8.5, 2.0-beta-2
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Description

      http://groovy.codehaus.org/api/groovy/lang/MetaObjectProtocol.html#getMetaMethod(java.lang.String, java.lang.Object[])

      The args parameter is described as "The argument types", but the method definition says "Retrieves an instance MetaMethod for the given name and argument values, using the types of the argument values to establish the chosen MetaMethod".

      For the former, I'd expect to pass in something like [String.class]; from the latter I'd expect to have to pass in [""]


      The code actually works with both!
      Looks like it eventually calls MetaClassHelper.castArgumentsToClassArray, which uses the arg if it's a Class, or uses argType.getClass() otherwise.

      If this is guaranteed to be the case in future version, then I'd suggest the wording:
      @param args The argument types: can be the Class objects, or example argument values for inferring the types

        Activity

          People

          • Assignee:
            Roshan Dawrani
            Reporter:
            Aled Sage
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: