14.2 The GrailsTypeChecked Annotation

GrailsTypeChecked

The grails.compiler.GrailsTypeChecked annotation works a lot like the GrailsCompileStatic annotation except that it only enables static type checking, not static compilation. This affords compile time feedback for expressions which cannot be validated statically at compile time while still leaving dynamic dispatch in place for the class.

  1. import grails.compiler.GrailsTypeChecked
  2. @GrailsTypeChecked
  3. class SomeClass {
  4. // all of the code in this class will be statically type
  5. // checked and will be dynamically dispatched at runtime
  6. def methodOne() {
  7. // ...
  8. }
  9. def methodTwo() {
  10. // ...
  11. }
  12. def methodThree() {
  13. // ...
  14. }
  15. }