Source Code Annotation

The line coverage of the active coverage session (see coverage view) is also directly displayed in the Java source editors. This works for Java source files contained in the project as well as source code attached to binary libraries.

Annotations

Source lines that correspond to compiled Java instructions get the following color code: Green for fully covered lines, yellow for partly covered lines and red for lines that have not been executed at all. These default colors can be modified in the Preferences dialog (see next section).

The source annotations automatically disappear when

Highlighting Preferences

The Eclipse preferences section General → Appearance → Editors → Text Editors → Annotations allows to modify the visual representation of coverage highlighting. The corresponding entries are:

Remarks about Line Coverage

In some situations it is not obvious, why particular lines are partially covered only. Please see EMMA's FAQ entry about partially covered lines for details. EMMA's concept of basic block coverage explains how coverage is measured in case of Java exceptions.