Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-1408

[gogo] coercion of args to match varargs method is inconsistent

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • gogo-0.2.0
    • Gogo Runtime
    • None

    Description

      gogo coerces the supplied arguments to match those required by the method.
      when the last parameter of a method is an array, gogo will coerce all remaining args into the array.

      For example:

      echo is defined as String echo(Object[] args);

      > echo d e f
      d e f

      above, gogo has coerced the 3 arguments into a single args[] array argument

      > list = [a b c]
      a
      b
      c

      > echo $list
      a b c

      here gogo passes the list directly, rather than as the first element of an array

      However, this is inconsistent when extra args are given:

      echo $list x
      x a b c

      The bug here is that the argument 'x' appears as the first, rather than the last argument to echo

      echo x $list
      x [a, b, c]

      The bug here is that the list is no longer expanded.
      The result should be:
      x a b c

      Attachments

        1. patch.txt
          1 kB
          Derek Baum

        Activity

          People

            db82407 Derek Baum
            db82407 Derek Baum
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: