Just can't figure out why these refuse to compile!
Tommy Svensson <[email protected]> Wed, 29 Oct 2025 17:50:50 +0100
| Newsgroups | gmane.comp.lang.groovy.user |
|---|---|
| Message-ID | <[email protected]> |
--690245f9_45937def_30b
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Hello Groovy users,
Both of the following totally refuses to compile and I mega fail in compr=
ehending why=21=21=21
=C2=A0 =C2=A0 private Map<SGID, Closure<SGMessage >> =3D new LinkedHashMa=
p<SGID, Closure<SGMessage >> ()
=C2=A0 =C2=A0 private Map<SGID, Closure<SGMessage >> =3D =5B:=5D
Is it forbidden to put a Closure in a Map =3F The Closure is a callback.=C2=
=A0
I've used Closures before without problems. I totally fail to se the prob=
lem here.=C2=A0
I prefer the second variant with =5B:=5D to define a Map.
I'm using Groovy 5.0.0
What am I =C2=A0doing wrong here =3F=3F=3F=3F=C2=A0
Best Regards,
Tommy Svensson
tommy=40natusoft.se
--690245f9_45937def_30b
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
<style>body=7Bfont-family:Helvetica,Arial;font-size:13px=7D</style><d=
iv id=3D=22bloop=5Fcustomfont=22 style=3D=22font-family:Helvetica,Arial;f=
ont-size:13px; margin: 0px; line-height: auto;=22>Hello Groovy users,</di=
v><div id=3D=22bloop=5Fcustomfont=22 style=3D=22font-family:Helvetica,Ari=
al;font-size:13px; margin: 0px; line-height: auto;=22><br></div><div id=3D=
=22bloop=5Fcustomfont=22 style=3D=22font-family:Helvetica,Arial;font-size=
:13px; margin: 0px; line-height: auto;=22>Both of the following totally r=
efuses to compile and I mega fail in comprehending why=21=21=21</div><div=
id=3D=22bloop=5Fcustomfont=22 style=3D=22font-family:Helvetica,Arial;fon=
t-size:13px; margin: 0px; line-height: auto;=22><br></div><div id=3D=22bl=
oop=5Fcustomfont=22 style=3D=22margin: 0px;=22><div id=3D=22bloop=5Fcusto=
mfont=22 style=3D=22margin: 0px;=22> private Map<SGID, Cl=
osure<SGMessage >> =3D new LinkedHashMap<SGID, Closure<SGM=
essage >> ()</div><div id=3D=22bloop=5Fcustomfont=22 style=3D=22mar=
gin: 0px;=22> private Map<SGID, Closure<SGMessage >=
> =3D =5B:=5D</div><div id=3D=22bloop=5Fcustomfont=22 style=3D=22margi=
n: 0px;=22><br></div><div id=3D=22bloop=5Fcustomfont=22 style=3D=22margin=
: 0px;=22>Is it forbidden to put a Closure in a Map =3F The Closure is a =
callback. </div><div style=3D=22font-family: Helvetica, Arial; font-=
size: 13px;=22><br></div><div style=3D=22font-family: Helvetica, Arial; f=
ont-size: 13px;=22>I've used Closures before without problems. I totally =
fail to se the problem here. </div><div style=3D=22font-family: Helv=
etica, Arial; font-size: 13px;=22><br></div><div style=3D=22font-family: =
Helvetica, Arial; font-size: 13px;=22>I prefer the second variant with =5B=
:=5D to define a Map.</div><div style=3D=22font-family: Helvetica, Arial;=
font-size: 13px;=22><br></div><div style=3D=22font-family: Helvetica, Ar=
ial; font-size: 13px;=22>I'm using Groovy 5.0.0</div><div style=3D=22font=
-family: Helvetica, Arial; font-size: 13px;=22><br></div><div style=3D=22=
font-family: Helvetica, Arial; font-size: 13px;=22>What am I doing =
wrong here =3F=3F=3F=3F </div><div style=3D=22font-family: Helvetica=
, Arial; font-size: 13px;=22><br></div><div style=3D=22font-family: Helve=
tica, Arial; font-size: 13px;=22>Best Regards,</div></div><div id=3D=22bl=
oop=5Fsign=5F1761755629923859200=22 class=3D=22bloop=5Fsign=22><p style=3D=
=22margin: 0px; font-style: normal; font-variant-caps: normal; font-stret=
ch: normal; font-size: 21px; line-height: normal; font-family: "Brad=
ley Hand"; font-size-adjust: none; font-kerning: auto; font-variant-=
alternates: normal; font-variant-ligatures: normal; font-variant-numeric:=
normal; font-variant-east-asian: normal; font-variant-position: normal; =
font-variant-emoji: normal; font-feature-settings: normal; font-optical-s=
izing: auto; font-variation-settings: normal;=22>Tommy Svensson</p>
<p style=3D=22margin: 0px; font-style: normal; font-variant-caps: normal;=
font-stretch: normal; font-size: 21px; line-height: normal; font-family:=
"Bradley Hand"; font-size-adjust: none; font-kerning: auto; fo=
nt-variant-alternates: normal; font-variant-ligatures: normal; font-varia=
nt-numeric: normal; font-variant-east-asian: normal; font-variant-positio=
n: normal; font-variant-emoji: normal; font-feature-settings: normal; fon=
t-optical-sizing: auto; font-variation-settings: normal;=22><a href=3D=22=
mailto:tommy=40natusoft.se=22>tommy=40natusoft.se</a></p><div><p style=3D=
=22margin: 0px; font-stretch: normal; font-size: 21px; line-height: norma=
l; font-family: "Bradley Hand"; font-size-adjust: none; font-ke=
rning: auto; font-variant-alternates: normal; font-variant-ligatures: nor=
mal; font-variant-numeric: normal; font-variant-east-asian: normal; font-=
variant-position: normal; font-feature-settings: normal; font-optical-siz=
ing: auto; font-variation-settings: normal;=22><br></p></div><div><br></d=
iv></div>
--690245f9_45937def_30b--