By DeepSource

Classes that contain only static members should not be instantiated JAVA-W1035


This code seems to be creating an instance of a class with only static members. Such a class does not need to be instantiated, since all members can be accessed with just the class itself.

Bad Practice

final class StaticHolder {
    public final static Object THING1 = new Object();
    public final static Object THING2 = new Object();

// ... elsewhere ...

StaticHolder someHolder = new StaticHolder();

// OR

Object thing = new StaticHolder().THING1; // Unnecessary!


Use the class instance directly.

Object thing = StaticHolder.THING1;