With Plugin: 4.0.6.v20150401-1945 I got every restart following error.
With previous versions it works. I have seen that useSingleton was renamed to the message is correct but this message came every time and I can not remove it from preferences and in my own PMD Ruleset this Rule is removed.
Runtime Exception when loading stored ruleset file. Falling back to default ruleset.Unable to find referenced rule UseSingleton; perhaps the rule name is mispelled?
java.lang.IllegalArgumentException: Unable to find referenced rule UseSingleton; perhaps the rule name is mispelled?
at net.sourceforge.pmd.RuleSetFactory.parseRuleReferenceNode(RuleSetFactory.java:517)
at net.sourceforge.pmd.RuleSetFactory.parseRuleNode(RuleSetFactory.java:293)
at net.sourceforge.pmd.RuleSetFactory.parseRuleSetNode(RuleSetFactory.java:242)
at net.sourceforge.pmd.RuleSetFactory.createRuleSet(RuleSetFactory.java:176)
at net.sourceforge.pmd.RuleSetFactory.createRuleSet(RuleSetFactory.java:171)
at net.sourceforge.pmd.RuleSetFactory.createRuleSet(RuleSetFactory.java:158)
at net.sourceforge.pmd.eclipse.runtime.preferences.impl.PreferencesManagerImpl.getRuleSetFromStateLocation(PreferencesManagerImpl.java:455)
at net.sourceforge.pmd.eclipse.runtime.preferences.impl.PreferencesManagerImpl.getRuleSet(PreferencesManagerImpl.java:250)
at net.sourceforge.pmd.eclipse.runtime.properties.impl.ProjectPropertiesImpl.(ProjectPropertiesImpl.java:99)
at net.sourceforge.pmd.eclipse.runtime.properties.impl.PropertiesFactoryImpl.newProjectProperties(PropertiesFactoryImpl.java:70)
at net.sourceforge.pmd.eclipse.runtime.properties.impl.ProjectPropertiesManagerImpl.loadProjectProperties(ProjectPropertiesManagerImpl.java:100)
at net.sourceforge.pmd.eclipse.plugin.PMDPlugin.loadProjectProperties(PMDPlugin.java:407)
at net.sourceforge.pmd.eclipse.runtime.cmd.ReviewCodeCmd.getProjectProperties(ReviewCodeCmd.java:361)
at net.sourceforge.pmd.eclipse.runtime.cmd.ReviewCodeCmd.processResourceDelta(ReviewCodeCmd.java:516)
at net.sourceforge.pmd.eclipse.runtime.cmd.ReviewCodeCmd.execute(ReviewCodeCmd.java:183)
at net.sourceforge.pmd.eclipse.runtime.cmd.JobCommandProcessor$1.run(JobCommandProcessor.java:90)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Found one solution:
changed in .metadata.plugins\net.sourceforge.pmd.eclipse.plugin\ruleset.xml
*
from
rulesets/java/design.xml/UseSingleton
to
rulesets/java/design.xml/UseUtilityClass*
Another way is to open Preferences and then check UseUtilityClass and uncheck them if needed. then the ruleset.xml should be changed also.
My suggestion is to update this setting if PMD updated to 5.1.0.
Glad you figured it out.
It is actually back from ticket [#1059] - when UseSingleton was renamed to UseUtilityClass. I missed to have a deprecated rule-reference in, to have a more smooth transition. I'll add this for 5.3.1.
However, this situation will occur more often, e.g. several rules have been renamed or moved in 5.3.0 (however, not deleted yet) and will be finally deleted with 5.4.0 - see http://pmd.sourceforge.net/pmd-5.3.0/overview/changelog.html for the list of deprecated rules.
I'll keep this ticket open - I think it makes sense to have some "update logic" in the eclipse plugin.
Thanks!
Related
Issues:
#1059thank for answering.
An Update logic will be great.
For now you aneed to apply the rules again and hope that the ruleset.xml is updated.
Diff:
Closing this ticket. PMD has now a compatibility rule set factory that can handle rules being renamed, moved and removed in a graceful way, while generating proper warnings for users.