You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2015/06/08 02:24:00 UTC

[jira] [Commented] (GROOVY-6539) OptionAccessor.arguments() does unneccessary transformations

    [ https://issues.apache.org/jira/browse/GROOVY-6539?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14576523#comment-14576523 ] 

Paul King commented on GROOVY-6539:
-----------------------------------

The current implementation has the slight advantage of doing a defensive copy of the arguments, e.g.:
{code}
def cli = new CliBuilder()
def opt = cli.parse(['foo', 'bar'])
def x = opt.arguments()
x.clear()
assert x == []
assert opt.arguments() == ['foo', 'bar']
{code}
But whether this is strictly needed is questionable, and could be achieved of course with one transformation not two by returning {{new ArrayList(inner.argList)}}.

> OptionAccessor.arguments() does unneccessary transformations
> ------------------------------------------------------------
>
>                 Key: GROOVY-6539
>                 URL: https://issues.apache.org/jira/browse/GROOVY-6539
>             Project: Groovy
>          Issue Type: Improvement
>          Components: command line processing
>    Affects Versions: 2.2.1
>            Reporter: Björn Kautler
>              Labels: CliBuilder
>
> OptionAccessor.arguments() returns inner.args.toList(), whereas inner.args transforms the inner field args, which is a list, to an array and returns it. Instead there is an inner.argList method which returns the args list directly. So it would probably be better to just return inner.argList from OptionAccessor.arguments()



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)