eclEmma - full code coverage on class header?
Asked Answered
Q

1

6

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?

Quod answered 30/5, 2010 at 9:2 Comment(4)
EclEmma should give you coverage numbers in the little panes below the editor as well. What do those say? Can you post the numbers (blocks, lines, instructions, etc.) for your sample class?Basaltware
Also, both of these classes implement or extend parameterized types. Is this behavior exhibited in classes which do not use generics in their definitions?Basaltware
This only occurs in these two classes that extend/implement parameterized types. I have other classes in the same situation that are fully covered. The difference is that the other classes parameterized types are defined by me. These types are defined in the Hadoop API. I have added the covered instructions in my question, above.Quod
What do you mean by "the header"? Is it the first line of the file, or the line containing the public class declaration?Calendar
C
3

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.

Calendar answered 30/5, 2010 at 13:32 Comment(3)
I was wracking my brain for this answer earlier. Good catch. Emma may have this option, but I don't remember whether EclEmma uses it when it's driving Emma from within Eclipse.Basaltware
Along these lines, Enums apparently also have some issues with Emma (padcom13.blogspot.com/2009/12/code-coverage-and-enum-types.html). Maybe Fork can find a similar workaround?Basaltware
Where do I disable it? One thing that I've noticed both of the classes I mentioned above use an enum that I have defined elsewhere. I am trying to test the enum, but no luck.Quod

© 2022 - 2024 — McMap. All rights reserved.