One of the common patterns I use to make a class abstract and final (this type of class has only static methods and should have no objects created) is to create a private default constructor with an empty block.
There is no way that this method can be called as the constructor is private and the Class itself never creates and object of its type. Emma reports that this block is not covered. It will be nice if we can avoid reporting coverage for this block.
Is there are way to filter such blocks from coverage metrics?
I also noticed that Emma reports coverage for default constructor created by the compiler if one is not declared. Is this not considered as synthetic code? If yes, why is emma reporting coverage when the default behavior of Emma is to ignore synthetic code.
Thanks,
Ravi
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The first feature (private constructors) is planned for a future version (http://sourceforge.net/mailarchive/forum.php?thread_id=5244259&forum_id=40481)
Regarding undeclared constructors, they used to be marked as Synthetic (and so excluded by EMMA by default), but no longer are by Sun's recent compilers. (Sun has changed position on this.)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
One of the common patterns I use to make a class abstract and final (this type of class has only static methods and should have no objects created) is to create a private default constructor with an empty block.
There is no way that this method can be called as the constructor is private and the Class itself never creates and object of its type. Emma reports that this block is not covered. It will be nice if we can avoid reporting coverage for this block.
Is there are way to filter such blocks from coverage metrics?
I also noticed that Emma reports coverage for default constructor created by the compiler if one is not declared. Is this not considered as synthetic code? If yes, why is emma reporting coverage when the default behavior of Emma is to ignore synthetic code.
Thanks,
Ravi
The first feature (private constructors) is planned for a future version (http://sourceforge.net/mailarchive/forum.php?thread_id=5244259&forum_id=40481)
Regarding undeclared constructors, they used to be marked as Synthetic (and so excluded by EMMA by default), but no longer are by Sun's recent compilers. (Sun has changed position on this.)