Skip to content

Commit 57e7048

Browse files
committed
Prefer a checkstyle suppression over a private constructor for package private class, otherwise the code coverage drops without a clean way to test the ctor.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/cli/trunk@1440316 13f79535-47bb-0310-9956-ffa450edef68
1 parent 5ff94c7 commit 57e7048

3 files changed

Lines changed: 5 additions & 14 deletions

File tree

src/conf/checkstyle-suppressions.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,9 @@
3030
<!-- Constant used in hashCode() method -->
3131
<suppress checks="MagicNumber" files="Option.java" />
3232

33+
<!-- These are final package private classes, and we do not want to hide the
34+
constructor as this will negatively affect the code coverage -->
35+
<suppress checks="HideUtilityClassConstructor" files="OptionValidator.java" />
36+
<suppress checks="HideUtilityClassConstructor" files="Util.java" />
37+
3338
</suppressions>

src/main/java/org/apache/commons/cli/OptionValidator.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,6 @@
2626
*/
2727
final class OptionValidator
2828
{
29-
/**
30-
* Hide constructor for a utility class.
31-
*/
32-
private OptionValidator()
33-
{
34-
}
35-
3629
/**
3730
* Validates whether <code>opt</code> is a permissible Option
3831
* shortOpt. The rules that specify if the <code>opt</code>

src/main/java/org/apache/commons/cli/Util.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,6 @@
2525
*/
2626
final class Util
2727
{
28-
/**
29-
* Hide constructor for a utility class.
30-
*/
31-
private Util()
32-
{
33-
}
34-
3528
/**
3629
* Remove the hyphens from the beginning of <code>str</code> and
3730
* return the new String.

0 commit comments

Comments
 (0)