EclEmma 3.1.9 Java Code Coverage for Eclipse Drag to your running Eclipse workspace to install EclEmma Java Code Coverage
Eclipse Community Award 2008
Inspected with sonarqube
jobs at mtrail
The Java Specialists' Newsletter

Source Code Annotation

Line coverage and branch coverage of the active coverage session 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.


Source lines containing executable code get the following color code:

  • green for fully covered lines,
  • yellow for partly covered lines (some instructions or branches missed) and
  • red for lines that have not been executed at all.

In addition colored diamonds are shown at the left for lines containing decision branches. The colors for the diamonds have a similar semantic than the line highlighting colors:

  • green for fully covered branches,
  • yellow for partly covered branches and
  • red when no branches in the particular line have been executed.

These default colors can be modified in the Preferences dialog (see next section). The source annotations automatically disappear when you start editing a source file or delete the coverage session.

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:

  • Full Coverage
  • Partial Coverage
  • No Coverage

Remarks about Line Coverage

In some situations it is not obvious, why particular lines do have highlighting or have a particular color. The reason is that the underlying code coverage library JaCoCo works on Java class files only. In some cases the Java compiler creates extra byte code for a particular line of source code. Such situations might be filtered by future versions of JaCoCo and EclEmma.