groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MG <mg...@arscreat.com>
Subject Re: IDE support for multi assignment statements
Date Fri, 11 Dec 2020 09:29:29 GMT
Hi Saravanan,

what IntelliJ version are you using ? We are not using multiple 
assignments in our code, but from my personal experience, IntelliJ can 
unfortunately sometimes be more than 2 years behind current Groovy 
features. If the newest IntelliJ version does not support what you need, 
opening a ticket did help in the past (see e.g. 
https://youtrack.jetbrains.com/issue/IDEA-193168), but you have to be 
prepared to wait some time before seeing improvements.
In addition to that, IntelliJ sometimes marks valid Groovy code as 
invalid, but reconsiders if one comments out the "offending" line(s), 
and then comments it in again (I assume doing this triggers a new 
Intellisense parser pass).

Interestingly afaik (disclaimer: I have not checked this recently, and 
we are still on Groovy 2.5.x), Groovy will treat e.g.
var x = new Foo()
and
final x = new Foo()
as x having type Object - it is just IntelliJ Intellisense that deduces 
x to be of type Foo*, thereby enabling auto completion, etc on x ;-)

Cheers,
mg

*In all but the most obscure cases


On 11/12/2020 06:54, Saravanan Palanichamy wrote:
> Hello
>
> I am using Groovy 3.0.5 and it supports multiple assignment statements from tuples when
using static compile
>
>      def(var1, var2) = Tuple.tuple("a", 1)
>
> but it looks like the Intellij IDE still calls this out as a compile error. Also it defaults
to identifying var1 and var2 as objects. This hinders code completion in subsequent code.
Is this an issue for anyone else? or do I just have to upgrade my IDE?


Mime
View raw message