[java] Deprecate redundant String Comparison rules #2493
Merged
Conversation
9cf64df to
01c283c
Compare
Generated by 🚫 Danger |
adangel
approved these changes
May 22, 2020
adangel
left a comment
Member
There was a problem hiding this comment.
Thanks! I'll do the minor changes when merging.
| <description> | ||
| Position literals first in comparisons, if the second argument is null then NullPointerExceptions | ||
| can be avoided, they will just return false. | ||
| can be avoided, they will just return false. This rule is replaced by the more general LiteralsFirstInComparisons rule. |
Member
There was a problem hiding this comment.
We should directly link to the other rule {% rule "LiteralsFirstInComparisons" %} and use a new paragraph - I'll change that, when merging.
|
|
||
| package net.sourceforge.pmd.lang.java.rule.bestpractices; | ||
|
|
||
| @Deprecated |
Member
There was a problem hiding this comment.
We should add a javadoc note to mention, that the class has been replaced by LiteralsFirstInComparisons. I'll do that, when merging.
adangel
added a commit
that referenced
this pull request
May 22, 2020
adangel
added a commit
that referenced
this pull request
May 22, 2020
[java] Deprecate redundant String Comparison rules #2493
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.
Describe the PR
The
AbstractPositionLiteralsFirstInComparisons,PositionLiteralsFirstInComparisons, andPositionLiteralsFirstInCaseInsensitiveComparisonsJava rules are replaced with a more general rule (LiteralsFirstInComparisons) that checks all forms of String comparisons.This PR adds deprecated tags to the rules and the rulesets.
Related issues
Added new replacement rule: #2478
Original thread: #2145
Ready?
./mvnw clean verifypasses (checked automatically by travis)