Setting retention of an annotation

Gosu supports the native Java meta-annotation @Retention. Pass one of the following RetentionPolicy enumeration constants:

  • CLASS – Annotations are recorded in the class file but need not be retained by the VM at run time.
  • RUNTIME – Annotations are recorded in the class file and retained by the VM at run time. These annotations can be read reflectively.
  • SOURCE – Annotations are discarded by the compiler.

For example:

uses java.lang.annotation.Retention

@Retention( RUNTIME)
annotation MyAnnotation {
  function purpose() : String
  function importance() : int = 0
}