forked from phoedos/pmd
[core] Internalize deprecated default ctor of XPathRule
This commit is contained in:
parent
adef8c29d5
commit
d54b8b3e8f
@ -1129,6 +1129,7 @@ The annotation `@DeprecatedUntil700` has been removed.
|
||||
* `hasOverriddenProperty(PropertyDescriptor)` - use {%jdoc core::lang.rule.RuleReference#isPropertyOverridden(core::properties.PropertyDescriptor) %} instead.
|
||||
* {%jdoc core::lang.rule.xpath.XPathRule %}
|
||||
* The constant `XPATH_DESCRIPTOR` has been made private and is not accessible anymore.
|
||||
* The default constructor has been made package-private and is not accessible anymore.
|
||||
* {%jdoc core::lang.Language %} - method `getTerseName()` removed. Use {%jdoc core::lang.Language#getId() %} instead.
|
||||
* {%jdoc core::lang.LanguageModuleBase %} - method `getTerseName()` removed. Use {%jdoc core::lang.LanguageModuleBase#getId() %} instead.
|
||||
* {%jdoc core::lang.LanguageRegistry %} - the following methods have been removed:
|
||||
|
@ -24,4 +24,8 @@ public final class InternalApiBridge {
|
||||
public static String replacementIfDeprecated(Attribute attribute) {
|
||||
return attribute.replacementIfDeprecated();
|
||||
}
|
||||
|
||||
public static XPathRule newXPathRule() {
|
||||
return new XPathRule();
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ import net.sourceforge.pmd.properties.PropertyDescriptor;
|
||||
import net.sourceforge.pmd.properties.PropertyFactory;
|
||||
import net.sourceforge.pmd.reporting.RuleContext;
|
||||
import net.sourceforge.pmd.util.IteratorUtil;
|
||||
import net.sourceforge.pmd.util.internal.ResourceLoader;
|
||||
|
||||
|
||||
/**
|
||||
@ -51,12 +52,10 @@ public final class XPathRule extends AbstractRule {
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated This is now only used by the ruleset loader. When
|
||||
* we have syntactic sugar for XPath rules in the XML, we won't
|
||||
* need this anymore.
|
||||
* This is only used by the ruleset loader.
|
||||
* @see ResourceLoader#loadRuleFromClassPath(String)
|
||||
*/
|
||||
@Deprecated
|
||||
public XPathRule() {
|
||||
XPathRule() {
|
||||
definePropertyDescriptor(XPATH_DESCRIPTOR);
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,8 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
import net.sourceforge.pmd.lang.rule.Rule;
|
||||
import net.sourceforge.pmd.lang.rule.xpath.InternalApiBridge;
|
||||
import net.sourceforge.pmd.lang.rule.xpath.XPathRule;
|
||||
|
||||
/**
|
||||
* @apiNote Internal API
|
||||
@ -129,6 +131,9 @@ public class ResourceLoader {
|
||||
* Load the rule from the classloader from resource loader, consistent with the ruleset
|
||||
*/
|
||||
public Rule loadRuleFromClassPath(final String clazz) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
|
||||
if (XPathRule.class.getName().equals(clazz)) {
|
||||
return InternalApiBridge.newXPathRule();
|
||||
}
|
||||
return (Rule) classLoader.loadClass(clazz).newInstance();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user