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?
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 t
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
P.S. Sorry I see I forgot to add the test for the seconds case (caller side
Map, no such thing at the receiver):
===
1054 ocs /tmp> /usr/local/groovy-4.0.25/bin/groovy q
a:[a:1] b:Hi c:there
1056 ocs /tmp>
===
> On 11. 4. 2025, at 16:12, o...@ocs.cz wrote:
>
> Christopher,
>
>> On 11. 4. 2025
When a Map is the first parameter, it acts as a collector for any named
parameters.
def foo(Map a, b, c) {
// ...
}
foo(a:'a', 'b', 'c', x: 'also a')
From: o...@ocs.cz
Sent: Friday, April 11, 2025 9:16 AM
To: Groovy_Developers
Subject: [EXT] Re: Lists in anno
Christopher,
> On 11. 4. 2025, at 15:55, Christopher Smith 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 argumen
Just an FYI, the support for @A({ ... }) is tracked by
https://issues.apache.org/jira/browse/GROOVY-11492
From: Paul King
Sent: Friday, April 11, 2025 5:20 AM
To: dev@groovy.apache.org
Subject: [EXT] Re: Lists in annotations
External Email: Use caution with li
Sure, I mentioned that (“unless one uses named arguments, which of course go
into that Map” below).
Also, collecting the named arguments in this Map is — far as I know, at least —
the only possible way to use them at all. If there is no callable method with a
first Map (or Object) argument and
Hello Everyone,
Grails recently had a bug report on one of the upgrades in 6.x.
https://github.com/apache/grails-core/issues/14130#issuecomment-2797619047
I've narrowed down the issue to the groovy upgrade from 3.0.21 to 3.0.23.
In groovy 3.0.21 the following code compiles:
class
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 integr
Git bisect shows it as the following commit causing the change in behavior:
https://github.com/apache/groovy/commit/09247dd06d
None of the mentioned issues have 3.0.23 added to the fix version, so
they don't appear in the 3.0.23 release notes, but maybe it wasn't the
whole fix that was backported
11 matches
Mail list logo