checkNamesForContextStrategyByTokenOrParentSet and checkNamesForContextStrategyByTokenOrAncestorSet do similar thing - they say patch-filter to change AST node to an upper level node for a certain Check, while detecting changed lines in a file.
The second property, checkNamesForContextStrategyByTokenOrAncestorSet, should accept a mapping between a check and AST token type. But instead it uses a hardcoded mapping for certain checks in JavaPatchFilterElement class for now.
Investigate how we can combine these two properties into one and be able to set a mapping between a check and AST ancestor token type.
I think it can work this way - if check is defined with no AST token type, then we just take its parent node; if check is defined with AST token type, then we try to find the first ancestor node with this token type.
checkNamesForContextStrategyByTokenOrParentSet
andcheckNamesForContextStrategyByTokenOrAncestorSet
do similar thing - they say patch-filter to change AST node to an upper level node for a certain Check, while detecting changed lines in a file.The second property, checkNamesForContextStrategyByTokenOrAncestorSet, should accept a mapping between a check and AST token type. But instead it uses a hardcoded mapping for certain checks in JavaPatchFilterElement class for now.
Investigate how we can combine these two properties into one and be able to set a mapping between a check and AST ancestor token type. I think it can work this way - if check is defined with no AST token type, then we just take its parent node; if check is defined with AST token type, then we try to find the first ancestor node with this token type.