This page details the case of false violation for quality rule "Provide a private default Constructor for utility Classes".
Release | Yes/No |
---|---|
8.3.x |
RDBMS | Yes/No |
---|---|
CSS | |
- Login to CED.
- Go to Investigation Quality Model Drill down View.
- Click on the rule name - Provide a private default Constructor for utility Classes.
In the example mentioned in the below screenshot you can see that there are a mixture of static and non-static methods in the class.
The best practice put forward by the rule is the fact that it is better not to have mixed classes having static and non-static method and without private constructor.
So you need to refactor your source code and have one utility class with private constructor and only one static member and all the other non static code to have it in a non-utility class.
Please note that this doesn’t mean that your code does not work. This means that there is a more efficient way to do it.
This is expected behavior and not a false positive.