Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Static compilation is now part of the Groovy 2.0.0 release. You can download the latest Groovy 2 releases and test it.

@CompileStatic

Static compilation is for the moment only supported at the method level (do not try to add it to a class) and supports direct method calls as long as you do not:

  • use methods from DefaultGroovyMethods
  • use "indirect" methods like list << obj where the AST representation is not a method call but a binary expression

For example, you You can try the following snippet :

Code Block
@groovy.transform.CompileStatic
int fib(int i) {
    i < 2 ? 1 : fib(i - 2) + fib(i - 1)
}

...