I'd raise a separate thread since this is now off-topic for the original thread. But, yes, the JDK doesn't have native support for named arguments, so if you use named arguments, some argument collecting will occur. The map, as first parameter, is the well-documented approach we use for Java integration purposes. If you have a case where given that knowledge, it is still confusing, I'd suggest chatting in a separate thread. Perhaps I've misunderstood what you were referring to.
On Fri, Apr 11, 2025 at 11:56 PM Christopher Smith <chrylis+gro...@gmail.com> wrote: > > I personally find it surprising and confusing that arguments are implicitly > collected in method calls; I recently was baffled until I realized that the > Map as a first argument was causing Groovy to group the leading arguments. I > appreciate Groovy's syntactic sugar for clear cases (such as trailing > lambdas), but I would rather not have arguments collected if the signature > isn't varargs. > > Christopher Smith > > On Fri, Apr 11, 2025, 05:22 Paul King <pa...@asert.com.au> wrote: >> >> I think it is just the case that Java supports only a single value or >> array notation, so that's what we did too (just adapting to Groovy >> array/list notation). >> >> We have certainly had folks ask if we could also support the curly >> brace syntax but that clashes with a closure. >> >> It would be interesting to see whether it is a simple or ugly change >> at the grammar/early parsing level. >> >> Cheers, Paul. >> >> On Fri, Apr 11, 2025 at 7:19 PM Gianluca Sartori <g.sart...@gmail.com> wrote: >> > >> > Hi folks, >> > >> > we use the following well known annotation in our Grails controllers: >> > >> > @Secured(['ROLE_USER', 'ROLE_OTHER']) >> > >> > I was wondering why we cannot write this instead: >> > >> > @Secured('ROLE_USER', 'ROLE_OTHER') >> > >> > like in method calls. >> > >> > To your knowledge is that a Groovy thing or it lies somewhere else? >> > >> > Cheers, >> > Gianluca Sartori >> >