[java] Fix false negative in AvoidLiteralsInIfCondition#2150
Merged
Conversation
Generated by 🚫 Danger |
Member
Author
|
Maybe we should add a property to enable the new behavior and keep the rule the same in PMD 6.x. In PMD 7, the default value of the property can be changed. |
Member
Author
|
TODOs:
|
In Saxon, NodeInfo.compareOrder is used to determine, whether a node is already contained in a union set or not. For different nodes it must return a value != 0. It should consider the position of the nodes in document order. The new implementation uses now the position of the nodes (begin line, begin column) to determine the order. It might fail, if the position of the nodes are not correct.
…tion If the IfCondition spans multiple lines, it easier to spot the literal, if the violation is reported on the correct line where the literal is located.
The property ignoreExpressions is set to true in order to keep the rule backwards compatible.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2140
This also contains a fix in the Saxon XPath integration in PMD: When using the union operator, we sometimes threw some nodes of the result away...
Before submitting a PR, please check that:
master. The PMD team will merge back to support branches as needed../mvnw clean verifypasses. This will build and test PMD, execute PMD and checkstyle rules. Check this for more info