NullMapCompletionException doesn't need to be instantiated
244
245 if (result == null) {
246 if (error == null) {
247 error = new NullMapCompletionException(); 248 }
249 for (var entry : proxies.entrySet()) {
250 cache.remove(entry.getKey(), entry.getValue());
Description
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!
Recommended
Use the class instance directly.
Object thing = StaticHolder.THING1;