Search code examples
javaunit-testingemma

eclEmma - full code coverage on class header?


I have a class that starts with:

public class GeneralID implements WritableComparable<GeneralID>{
...
}

And another that is:

public class LineValuesMapper<KI, VI, KO, VO> extends Mapper<LongWritable, Text, Text, IntWritable>{
...
}

All methods in these classes are covered. But not their header. The header of both classes gets painted as yellow with EclEmma.

The covered instructions for these classes are:

Element Coverage    Covered Instructions    Total Instructions
LineValuesMapper.java   97.3 %  145 149
GeneralID.java  99.3 %  566 570

Is there anything I can do to fully cover the class header?


Solution

  • For classes that extend generic superclasses or implement generic interfaces, the compiler may add synthetic bridge methods. See the results of looking at the bytecode of a similar case.

    Maybe in your classes, these bridge methods are not called. OTOH, I just read that Emma has an option for ignoring synthetic or bridge methods which is enabled by default.