concept @CompileStatic in category groovy

This is an excerpt from Manning's book Groovy in Action, Second Edition.
Since Groovy 2.0, you can make the Groovy compiler behave more like you’d expect when using a traditional static language by enforcing type checking at compile time. This isn’t done by default, but it is easily activated by annotating your code with @TypeChecked or @CompileStatic. In chapter 3, we’ll dive into the details of typing in Groovy and explain the possible options, and we devote all of chapter 10 to static typing aspects of Groovy.
Since @TypeChecked works at compile time it cannot always know what the runtime method dispatch will do. It needs to make assumptions. There’s a remaining risk that it chooses the “wrong” method. This will later become more important when we introduce @CompileStatic, which additionally has an effect on the generated code.