Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 687
Tiago Veloso Avatar asked May 30 '10 09:05

Tiago Veloso


People also ask

How does EclEmma determine code coverage?

The Eclipse Plug-InEclEmma retrieves code coverage metrics as conveniently as you execute your test suites directly in the IDE . The plugin can be easily installed from its update site at http://update.eclemma.org/ on any Eclipse installation of version 3.5 or above. It is also available from the Eclipse Marketplace.

How do I check code coverage in STS 4?

Right-click on project > Properties > Coverage to enable code coverage. Then, right-click on project > Run Code Coverage.


1 Answers

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.

like image 113
Christian Semrau Avatar answered Sep 21 '22 15:09

Christian Semrau