Hmm ... clearly a case of brain deadness yesterday!! 

I missed the actual variable being declared ... 
  
 Tommy Svensson

[email protected]



  
Från: Tommy Svensson <[email protected]>
Svara: [email protected] <[email protected]>
Datum: 29 oktober 2025 at 17:52:03
Till: [email protected] <[email protected]>
Ämne:  Just can't figure out why these refuse to compile!  


  
    Hello Groovy users,

Both of the following totally refuses to compile and I mega fail in 
comprehending why!!!

    private Map<SGID, Closure<SGMessage >> = new LinkedHashMap<SGID, 
Closure<SGMessage >> ()
    private Map<SGID, Closure<SGMessage >> = [:]

Is it forbidden to put a Closure in a Map ? The Closure is a callback. 

I've used Closures before without problems. I totally fail to se the problem 
here. 

I prefer the second variant with [:] to define a Map.

I'm using Groovy 5.0.0

What am I  doing wrong here ???? 

Best Regards,

Tommy Svensson

[email protected]

Reply via email to