Clover supports a number of inline source directives that you can use in your source to control instrumentation. Directives can be on a line by themselves or part of any valid single or multi-line Java comment.
Clover source directives currently do not support Groovy.
Switching Clover on and off
This directive will switch Clover instrumentation on/off. This might be useful if you don't want Clover to instrument a section of code for some reason. For example, some bytecode-manipulating frameworks require certain sections to be excluded (JMockit for instance). Note that the scope of this directive is the current file only.
Force Clover to flush
Clover will insert code to flush coverage data to disk. The flush code will be inserted as soon as possible after the directive. See Using a Flush Policy.
Mark lambda expression returning void (since Clover 4.0.5)
This directive will mark lambda expression as returning void. Clover applies heuristic for some of lambda expressions and rewrites them to lambda blocks. In case of
unexpected return value compilation errors, it may be necessary to mark some lambda expressions as void to let Clover know it shouldn't instrument it with the
For example, the following code:
may fail to compile if put() method returns void with the following error:
It may be required to mark such lambda expression as void with
More information about this compilation error may be found in one of the Clover KB articles
The CLOVER:VOID directive outside lambda context does not have any effect.