groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Amerige <>
Subject Changing the default to TypeChecked
Date Wed, 27 May 2015 16:00:59 GMT
Hi all,

Jochen showed us how to default to CompileStatic 

in a post a few months ago.  A question was raised about about changing 
the default to TypeChecked for the case where a user doesn't want 
CompileStatic as a default, but does want TypeChecked as a default.  
Would it be the same solution as above? That is:


    withConfig(configuration) {

and then do: groovyc -configscriptsrc/conf/config.groovy 

Also, if one were to specify:


    withConfig(configuration) {

would that also mean that TypeChecked is enabled by default?  How is it 
disabled for a given class or method?  Or, would one need to do the 


    withConfig(configuration) {

In summary, I'm asking:

 1. Is adding ast(groovy.transform.TypeChecked) in the config file how
    to turn on TypeChecked by default?
 2. What is the idiom to disable TypeChecked for a given class or method?
 3. Does CompileStatic imply TypeChecked (so that if CompileStatic is
    specified, it is not necessary to specify TypeChecked in a config file)?

Steve Amerige
Principal Software Developer, Fraud and Compliance Solutions Development
SAS Institute, 100 SAS Campus Dr, Room U3050, Cary, NC 27513-8617

P.S.  By the way, having the ability to set the default for strong type 
checking and static compilation while at the same time allowing for 
specific exceptions (via @CompileDynamic, for example) has been very 
useful in reducing push-back regarding Groovy adoption. Similarly, 
disallowing @Grab 
as C├ędric suggests is also part of helps enterprises embrace Groovy. I 
encourage people to promote this and other similar features when 
encountering resistance!  I think there should be an entire section in 
the documentation that focuses on issues like these that are of interest 
to large enterprises.

View raw message