checkstyle / patch-filters

Suppression Filter for Checkstyle that is based on patch file
GNU Lesser General Public License v2.1
4 stars 6 forks source link

Make checkNamesForContextStrategyByTokenOrAncestorSet and checkNamesForContextStrategyByTokenOrParentSet work together #331

Closed HuGanghui closed 4 years ago

HuGanghui commented 4 years ago

Current code have a small bug that if one check is listed in both checkNamesForContextStrategyByTokenOrAncestorSet and checkNamesForContextStrategyByTokenOrParentSet, then some unexpected error may happen. Because the logic in current code, after the list get its ancestors' node, it still will get its ancestors' node's parent again.

https://github.com/checkstyle/patch-filters/blob/36d47cbfd4e988ad568ab9d2783688b2a20b8776/src/main/java/com/puppycrawl/tools/checkstyle/filters/JavaPatchFilterElement.java#L282-L302

HuGanghui commented 4 years ago

Sorry, code is ok, I misjudged it