Skip to content

Add a private constructor in the Utils class to hide the implicit public one. #51

@danielmunteanu123

Description

@danielmunteanu123

Screenshot_20
I've used SonarQube and found this bug which is not critical but it should be fixed.
Utility classes should not have public constructors

Utility classes, which are collections of static members, are not meant to be instantiated. Even abstract utility classes, which can be extended, should not have public constructors.
Java adds an implicit public constructor to every class which does not define at least one explicitly. Hence, at least one non-public constructor should be defined.

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions