Inspectopedia
 
2024.3

Utility class with 'public' constructor

Warning
New
Last modified: 03 December 2024

Reports utility classes with public constructors.

Utility classes have all fields and methods declared as static. Creating a public constructor in such classes is confusing and may cause accidental class instantiation.

Example:

After the quick-fix is applied: