groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Theodorou <>
Subject Re: @CompileStatic null iteration
Date Fri, 15 Dec 2017 19:29:32 GMT
On 15.12.2017 16:44, mg wrote:
> "If we want to keep static Groovy near Java as much as possible..." - 
> who wants that ? ;-)

ok, scratch the "as possible". As required form a performance and 
integration point of view. Doing method calls not the Java way will hurt 
performance. Would I for example compile as

if (foo==null) {
} else {

then I would really change each and every invocation that is not based 
on this or super. The JVM is good at code elimination, but the guard 
will be still there, increase the bytecode size and have other effects. 
I collected some experience with this kind of logic when implementing 
the primitive optimizations.

> That is pretty much what I expected. So warning developers about this is 
> the best thing to do.

yes, static method calls, be it done in Java or static Groovy, are 
different than in normal Groovy.

> Btw, do we already have an official "@CompileStatic gotchas" section 
> somewhere ?

I think not. Feel free to add one ;)

bye Jochen

View raw message