Description

This page details the case of false violation for quality rule "Provide a private default Constructor for utility Classes".

Observed in CAST AIP


Release
Yes/No
8.3.x(tick) 
Observed on RDBMS


RDBMS
Yes/No
CSS(tick)
Step by Step Scenario
  1. Login to CED.
  2. Go to Investigation Quality Model Drill down View.
  3. Click on the rule name - Provide a private default Constructor for utility Classes.
Details

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.

Notes/comments
 Ticket # 4185
Related Pages