@Documented @Retention(SOURCE) @Target({METHOD,TYPE,CONSTRUCTOR}) public @interface CompileStatic
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 classes) within the method.
By using TypeCheckingMode.SKIP
, static compilation can be skipped on an
element within a class or method otherwise marked with CompileStatic. For example
a class can be annotated with CompileStatic, and a method within can be marked
to skip static checking to use dynamic language features.
CompileDynamic
Modifier and Type | Optional Element | Description |
---|---|---|
String[] |
extensions |
The list of (classpath resources) paths to type checking DSL scripts, also known
as type checking extensions.
|
TypeCheckingMode |
value |
TypeCheckingMode value
String[] extensions