The name of the rule is incorrect…
It's description:
"If you have a class that has nothing but static methods, consider making it a Singleton. Note that this doesn't apply to abstract classes, since their subclasses may well include non-static methods. Also, if you want this class to be a Singleton, remember to add a private constructor to prevent instantiation."
This rule should be called "Use Utility class".
A Singleton is where the class is instantiated, but once.
A Singleton therefore often does have member methods.
Also despite the formal definition, in practice Singletons don't necessary enforce instantiation through private constructors either, for example spring beans are singletons (when not prototype beans) yet they typically have public contructors.
On the other hand a Utility class is never instantiated.
And therefore only ever has static methods. It seems that this rule is rather indicating that the code should be made into a Utility class.
(ref: https://sourceforge.net/p/pmd/discussion/188194/thread/06a3caa5#0946 )
Diff:
Agreed - I'll rename it for PMD 5.1.0.
See also
Maybe this pattern was years back, when this rule has been written (it says since PMD 0.3 :)), indeed known as singleton, but nowadays it is really a utility class. Time to change...