@Documented @Retention(value=RUNTIME) @Target(value=PARAMETER) public @interface DelegatesTo
This annotation can also be used to help the type checker (TypeChecked
)
which would not report errors then if the delegate is of the documented type. Of course, it is
also compatible with CompileStatic
.
Example:
// Document the fact that the delegate of the closure will be an ExecSpec ExecResult exec(@DelegatesTo(ExecSpec) Closure closure) { ... }