PrivateConstructorForUtilityClass
Classes which are not intended to be instantiated should be made non-instantiable with a private constructor. This includes utility classes (classes with only static members), and the main class.

Severity
SUGGESTION
Has Fix?

The problem

Utility classes are classes that only include static members and are not designed to be instantiated, for example java.lang.Math or java.util.Arrays.

In the absence of explicit constructors, however, the compiler provides a public, parameterless default constructor. To a user, this constructor is indistinguishable from any other. It is not uncommon for a published API to accidentally include a public constructor for a class intended to be uninstantiable.

To prevent users from instantiating classes that are not designed to be instantiated, you can add a private constructor:

public class UtilityClass {
  private UtilityClass() {}
}

See:

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("PrivateConstructorForUtilityClass") to the enclosing element.