Groovy
  1. Groovy
  2. GROOVY-5161

MetaObjectProtocol.getMetaMethod doc for "args" is ambiguous

    Details

    • Type: Bug Bug
    • Status: 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

      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

        Aled Sage created issue -
        Roshan Dawrani made changes -
        Field Original Value New Value
        Assignee Roshan Dawrani [ roshandawrani ]
        Roshan Dawrani made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Fix Version/s 2.0-beta-2 [ 18072 ]
        Fix Version/s 1.8.5 [ 18071 ]
        Paul King made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Mark Thomas made changes -
        Project Import Sun Apr 05 13:32:57 UTC 2015 [ 1428240777691 ]
        Mark Thomas made changes -
        Workflow jira [ 12734085 ] Default workflow, editable Closed status [ 12745859 ]
        Mark Thomas made changes -
        Project Import Mon Apr 06 02:11:23 UTC 2015 [ 1428286283443 ]
        Mark Thomas made changes -
        Workflow jira [ 12971577 ] Default workflow, editable Closed status [ 12979399 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development