Skip to content

Commit

Permalink
Issue checkstyle#9936: Deprecate 'DetailAST.branchContains`
Browse files Browse the repository at this point in the history
  • Loading branch information
nrmancuso authored and romani committed Apr 29, 2021
1 parent 97a6af1 commit 991b99e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions config/checkstyle_checks.xml
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,13 @@
<property name="query" value="//ANNOTATION[./IDENT[@text='Issue']]"/>
<message key="matchxpath.match" value="Avoid using @Issue annotation."/>
</module>
<!-- until https://github.com/checkstyle/checkstyle/issues/5234 -->
<module name="MatchXpath">
<property name="id" value="MatchXPathBranchContains"/>
<property name="query" value="//METHOD_CALL//DOT[.//IDENT[@text = 'branchContains']]"/>
<message key="matchxpath.match"
value="Avoid using deprecated method 'DetailAst.branchContains()'."/>
</module>
<module name="MissingCtor">
<!--
we will not use that fanatic validation, extra code is not good
Expand Down
3 changes: 3 additions & 0 deletions config/suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,7 @@
<!-- Usage of unicode characters to assert the functioning of Xpath on escape character. -->
<suppress id="RegexpSinglelineJava" files="[\\/]XpathQueryGeneratorTest.java"/>

<!-- until https://github.com/checkstyle/checkstyle/issues/5234 -->
<suppress id="MatchXPathBranchContains" files="[\\/]DetailAstImplTest.java"/>

</suppressions>
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,15 @@ public interface DetailAST {
* Checks if this branch of the parse tree contains a token
* of the provided type.
*
* @deprecated
* Usage of this method is no longer accepted. We encourage
* traversal of subtrees to be written per the needs of each check
* to avoid unintended side effects.
* @param type a TokenType
* @return true if and only if this branch (including this node)
* contains a token of type {@code type}.
*/
@Deprecated
boolean branchContains(int type);

/**
Expand Down

0 comments on commit 991b99e

Please sign in to comment.