From 90ab50ca2996a57dcf99a53d73f6ad5b8c18a15c Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 8 Feb 2024 08:37:41 +0100 Subject: [PATCH] [core] Remove XPathRule#XPATH_DESCRIPTOR --- docs/pages/release_notes.md | 2 ++ .../main/java/net/sourceforge/pmd/lang/rule/XPathRule.java | 6 +----- .../java/net/sourceforge/pmd/docs/RuleDocGenerator.java | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 5414eb8cc9..dc6d2452e6 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -215,6 +215,8 @@ The following previously deprecated rules have been finally removed: * {%jdoc !!core::lang.rule.RuleReference %} - the following methods have been removed: * `setRuleSetReference(RuleSetReference)` - without replacement. Just construct new {%jdoc core::lang.rule.RuleReference %} instead. * `hasOverriddenProperty(PropertyDescriptor)` - use {%jdoc core::lang.rule.RuleReference#isPropertyOverridden(core::properties.PropertyDescriptor) %} instead. + * {%jdoc !!core::lang.rule.XPathRule %} + * The constant `XPATH_DESCRIPTOR` has been made private and is not accessible anymore. * pmd-apex * {%jdoc apex::lang.apex.ast.ApexNode %} and {% jdoc apex::lang.apex.ast.ASTApexFile %} * `#getApexVersion()`: In PMD 6, this method has been deprecated but was defined in the class `ApexRootNode`. diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/XPathRule.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/XPathRule.java index 12300fc732..a976ab1a45 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/XPathRule.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/XPathRule.java @@ -38,11 +38,7 @@ public final class XPathRule extends AbstractRule { // TODO move to XPath subpackage - /** - * @deprecated Use {@link #XPathRule(XPathVersion, String)} - */ - @Deprecated - public static final PropertyDescriptor XPATH_DESCRIPTOR = + private static final PropertyDescriptor XPATH_DESCRIPTOR = PropertyFactory.stringProperty("xpath") .desc("XPath expression") .defaultValue("") diff --git a/pmd-doc/src/main/java/net/sourceforge/pmd/docs/RuleDocGenerator.java b/pmd-doc/src/main/java/net/sourceforge/pmd/docs/RuleDocGenerator.java index 10edb13cc5..8f1a31bd4a 100644 --- a/pmd-doc/src/main/java/net/sourceforge/pmd/docs/RuleDocGenerator.java +++ b/pmd-doc/src/main/java/net/sourceforge/pmd/docs/RuleDocGenerator.java @@ -436,7 +436,7 @@ public class RuleDocGenerator { // filter out standard properties properties.remove(Rule.VIOLATION_SUPPRESS_REGEX_DESCRIPTOR); properties.remove(Rule.VIOLATION_SUPPRESS_XPATH_DESCRIPTOR); - properties.remove(XPathRule.XPATH_DESCRIPTOR); + properties.removeIf(p -> "xpath".equals(p.name())); // this is XPathRule.XPATH_DESCRIPTOR properties.remove(XPathRule.VERSION_DESCRIPTOR); if (!properties.isEmpty()) {