groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From roro codeath <rorocode...@gmail.com>
Subject Fwd: Why arguments are inversed when i use meth(arg, arg2, ...args
Date Sun, 05 Apr 2015 15:06:33 GMT
---------- Forwarded message ----------
From: roro codeath <rorocodeath@gmail.com>
Date: Sun, Apr 5, 2015 at 10:58 PM
Subject: Why arguments are inversed when i use meth(arg, arg2, ...args
To: users@groovy.incubator.apache.org


see my example:

class Ex3 {
    def m(arg, arg2, ... args) {
        println "arg: $arg"
        println "arg2: $arg2"
        println "args: $args"
    }

    static void main(args) {
        new Ex3().m(1, 2, k: 'v')
    }
}


I get output

arg: [k:v]
arg2: 1
args: [2]


but i expect

arg: 1

arg2: 2

args: [k:'v']


my gradle version is:

------------------------------------------------------------
Gradle 2.3
------------------------------------------------------------

Build time:   2015-02-16 05:09:33 UTC
Build number: none
Revision:     586be72bf6e3df1ee7676d1f2a3afd9157341274

Groovy:       2.3.9
Ant:          Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM:          1.8.0_05 (Oracle Corporation 25.5-b02)
OS:           Linux 3.13.0-24-generic amd64

Mime
View raw message