From 04592c80381ea8f79485117307edd8d59130b1df Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sun, 13 Sep 2020 09:18:34 +0200 Subject: [PATCH] [core] Deprecate RuleReference#getOverriddenLanguage() and #setLanguage() Refs #2742 --- docs/pages/release_notes.md | 2 ++ .../java/net/sourceforge/pmd/lang/rule/RuleReference.java | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index a62f4d5286..ae5d666137 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -48,6 +48,8 @@ AbstractTokenizer and the custom tokenizers of Fortran, Perl and Ruby are deprec * {% jdoc !!fortran::cpd.FortranTokenizer %}. Was replaced by an {% jdoc core::cpd.AnyTokenizer %}. Use {% jdoc !!fortran::cpd.FortranLanguage#getTokenizer() %} anyway. * {% jdoc !!perl::cpd.PerlTokenizer %}. Was replaced by an {% jdoc core::cpd.AnyTokenizer %}. Use {% jdoc !!perl::cpd.PerlLanguage#getTokenizer() %} anyway. * {% jdoc !!ruby::cpd.RubyTokenizer %}. Was replaced by an {% jdoc core::cpd.AnyTokenizer %}. Use {% jdoc !!ruby::cpd.RubyLanguage#getTokenizer() %} anyway. +* {% jdoc !!core::lang.rule.RuleReference#getOverriddenLanguage() %} and + {% jdoc !!core::lang.rule.RuleReference#setLanguage(net.sourceforge.pmd.lang.Language) %} ### External Contributions diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/RuleReference.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/RuleReference.java index 8be658244b..0ae75a924e 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/RuleReference.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/RuleReference.java @@ -85,13 +85,21 @@ public class RuleReference extends AbstractDelegateRule { this.setRule(ref.getRule().deepCopy()); } + /** + * @deprecated overriding the language of a rule is not supported. + */ + @Deprecated public Language getOverriddenLanguage() { return language; } + /** + * @deprecated overriding the language of a rule is not supported. + */ // FIXME should we really allow overriding the language of a rule? // I don't see any case where this wouldn't just make the rule fail during execution @Override + @Deprecated public void setLanguage(Language language) { // Only override if different than current value, or if already // overridden.