groovy (moved to ASF)
  1. groovy (moved to ASF)
  2. GROOVY-5161

MetaObjectProtocol.getMetaMethod doc for "args" is ambiguous


    • 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:
    • Number of attachments :

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


        Roshan Dawrani made changes -
        Field Original Value New Value
        Assignee Roshan Dawrani [ roshandawrani ]
        Roshan Dawrani made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.0-beta-2 [ 18072 ]
        Fix Version/s 1.8.5 [ 18071 ]
        Resolution Fixed [ 1 ]
        Paul King made changes -
        Status Resolved [ 5 ] Closed [ 6 ]


          • Assignee:
            Roshan Dawrani
            Aled Sage


            • Created: