View by Classes

Findings - Overview

code-style Hide Utility Class Constructor (Checkstyle)

Utility classes should not have a public or default constructor.

Further info on the wiki.

Make sure that utility classes (classes that contain only static methods) do not have a public constructor.

Rationale: Instantiating utility classes does not make sense. Hence the constructors should either be private or (if you want to allow subclassing) protected. A common mistake is forgetting to hide the default constructor.

If you make the constructor protected you may want to consider the following constructor implementation technique to disallow instantiating subclasses:

public class StringUtils // not final to allow subclassing
{
    protected StringUtils() {
        throw new UnsupportedOperationException(); // prevents calls from subclass
    }

    public static int count(char c, String s) {
        // ...
    }
}
      
2org.jcoderz.commons.util.DbUtilServerTest
 [278:4],  [286:4]
1org.jcoderz.phoenix.report.EmmaReportReader
 [314:5]
1org.jcoderz.commons.tracing.TracingInjector
 [71:1]
1org.jcoderz.commons.config.ConfigurationCacheByPropertiesImpl
 [247:4]
1org.jcoderz.guidelines.JavaCodeSnippets
 [53:1]
1org.jcoderz.commons.config.ConfigurationCacheByDbReadOnlyImpl
 [304:4]
1org.jcoderz.guidelines.snippets.ReferringSample
 [40:1]
1org.jcoderz.guidelines.snippets.MemberSample
 [41:1]
1org.jcoderz.commons.util.DateUserType
 [115:5]
1org.jcoderz.phoenix.sqlparser.SqlTransformer
 [522:4]