GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — [java] Fix #6237: Deprecate AddEmptyString without replacement by amritkang165 · Pull Request #7311 · pmd/pmd Conversation
|
|
Compared to main: (comment created at 2026-11-10 22:49:11+00:00 for fce9a57) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| @Test | ||
| void explicitReferenceStillLoadsDeprecatedRule() { | ||
| Rule rule = new RuleSetLoader().warnDeprecated(false) | ||
| .loadFromResource("category/java/performance.xml/AddEmptyString") | ||
| .getRuleByName("AddEmptyString"); | ||
|
|
||
| assertNotNull(rule); | ||
| assertTrue(rule.isDeprecated()); | ||
| } | ||
|
|
||
| @Test | ||
| void categoryReferenceExcludesDeprecatedRule() { | ||
| RuleSet rules = new RuleSetLoader().loadFromString("ruleset.xml", | ||
| "<ruleset name=\"test\">" | ||
| + "<description>Performance rules</description>" | ||
| + "<rule ref=\"category/java/performance.xml\"/>" | ||
| + "</ruleset>"); | ||
|
|
||
| assertNull(rules.getRuleByName("AddEmptyString")); | ||
| assertNotNull(rules.getRuleByName("AppendCharacterWithChar")); | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
We already have tests that verify that a a deprecated rule isn't loaded when a whole category is included. See https://github.com/pmd/pmd/blob/main/pmd-core/src/test/java/net/sourceforge/pmd/lang/rule/RuleSetFactoryTest.java#L809
Please remove this, it's just one more thing to forget when we remove the rule.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Removed the duplicate test and unused imports in 2cfc635. Tests and Checkstyle pass. Thanks for pointing this out!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I think this should apply to both tests, you can remove the second one too (most deprecated rules have just the .xml based tests).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Removed the second test too in fce9a57. The existing XML tests are unchanged, and all 121 selected tests and Checkstyle pass. Thanks
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
[java] AddEmptyString: Deprecate rule because performance claim is not valid anymore
There was an error while loading. Please reload this page.