groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Winnebeck, Jason" <Jason.Winneb...@windstream.com>
Subject RE: Is it possible to enable CompileStatic for an entire project
Date Tue, 21 Jun 2016 15:41:30 GMT
The annotations also work on classes, per the documentation:

When a class is annotated, all methods, properties, files, inner classes, etc. of the annotated
class will be type checked. When a method is annotated, static compilation applies only to
items (closures and anonymous inner clsses) within the method.

Jason

From: Charles G [mailto:charlesg@gmail.com]
Sent: Tuesday, June 21, 2016 11:39 AM
To: users@groovy.apache.org
Subject: Re: Is it possible to enable CompileStatic for an entire project

If we do it the doc way:  http://docs.groovy-lang.org/latest/html/documentation/#_static_compilation_by_default
would I just use http://docs.groovy-lang.org/next/html/gapi/groovy/transform/CompileDynamic.html
for classes I want to be dynamic -- or is it for methods only?

Docs: http://docs.groovy-lang.org/next/html/gapi/groovy/transform/CompileStatic.html  seem
to make it seem like you can only use it on methods?



On Tue, Jun 21, 2016 at 7:40 AM, Thibault Kruse <tibokruse@googlemail.com<mailto:tibokruse@googlemail.com>>
wrote:
I would prefer to have a codenarc rule enforcing @CompileStatic for
projects requiring it that way.

On Tue, Jun 21, 2016 at 2:38 PM, Winnebeck, Jason
<Jason.Winnebeck@windstream.com<mailto:Jason.Winnebeck@windstream.com>> wrote:
> Tying Cédric’s advice to your previous question about gmavenplus and joint
> compilation, per
> https://github.com/groovy/GMavenPlus/wiki/Examples#configuration-script you
> add the configuration tag with a reference to your groovy script.
>
>
>
> Actually about 90+% of our code base in Groovy is CompileStatic I wonder if
> we should use that. Cédric, if we use the config script method, is it still
> possible to use the “skip” annotation to switch back to dynamic mode? Even
> if it worked, I highly doubt IntelliJ IDEA would know about it and think all
> files are dynamic typing so probably it’s still best for us to add
> @CompileStatic everywhere, but sometimes we forget where we wanted it. The
> performance difference is extreme when we forget it, on a certain class we
> missed recently it took our page rendering times from about 4ms to 52ms, so
> for us it’s an actual “bug” to forget to add @CompileStatic.
>
>
>
> Jason
>
>
>
> From: Cédric Champeau [mailto:cedric.champeau@gmail.com<mailto:cedric.champeau@gmail.com>]
> Sent: Tuesday, June 21, 2016 8:29 AM
> To: users@groovy.apache.org<mailto:users@groovy.apache.org>
> Subject: Re: Is it possible to enable CompileStatic for an entire project
>
>
>
> It's in the docs:
> http://docs.groovy-lang.org/latest/html/documentation/#_static_compilation_by_default
>
>
>
> 2016-06-21 14:24 GMT+02:00 Mr Andersson <mr.andersson.002@gmail.com<mailto:mr.andersson.002@gmail.com>>:
>
> Is it possible to enable CompileStatic for an entire project?
>
> Or do you have to do it on a per class basis?
>
> I like Groovy for some of it's features, and mostly for it's close to Java
> syntax but I would really like it to be a static language.
>
> I've heard about Groovy++ but I believe that's dead by now, no?
>
> Question is wether you can tell the Groovy compiler with a flag to treat all
> Groovy classes on certain paths as static?
>
> Preferable doable from ANT too.
>
>
>
> ________________________________
> This email message and any attachments are for the sole use of the intended
> recipient(s). Any unauthorized review, use, disclosure or distribution is
> prohibited. If you are not the intended recipient, please contact the sender
> by reply email and destroy all copies of the original message and any
> attachments.


----------------------------------------------------------------------
This email message and any attachments are for the sole use of the intended recipient(s).
Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the
intended recipient, please contact the sender by reply email and destroy all copies of the
original message and any attachments.
Mime
View raw message