Commit Graph

3 Commits

Author SHA1 Message Date
Bas Leijdekkers
ed2c73e98c more consistent Java inspection names
GitOrigin-RevId: 5c958dfd8b5f55e9e5bede82be5015c3299dd16e
2021-12-20 10:55:14 +00:00
Nikita Eshkeev
565443bca4 [codeInsight] IDEA-219640 Inspection to detect some pointless String.substring
This patch fixes the notes from the review, it contains:

1. fixing the javadoc for ExpressionUtils#isConversionToStringNecessary
2. properly handling JavaTokenType.MINUS in ExpressionUtils#isDifference
3. properly handling complex PsiPolyadicExpression values in ExpressionUtils#isDifference
4. changing ProblemHighlightType to GENERIC_ERROR_OR_WARNING for
inspecitons like these
5. fixing the comments duplication problem when replacing the old string
with a new one for inspections like stringValue.substring(0, 1).equals("_")

Signed-off-by: Nikita Eshkeev <nikita.eshkeev@jetbrains.com>

GitOrigin-RevId: 907524c9026e2d1d7cd6f0bd7b988e478e73298d
2020-04-20 20:10:15 +00:00
Nikita Eshkeev
0aa2e160b0 [codeInsight] IDEA-219640 Inspection to detect some pointless String.substring
This patch fixes the notes from the review, it includes:

- restoring annotation.naming.convention.display.name
- using com.intellij.openapi.util.Pair instead of custom private objects
- using EquivalenceChecker.expressionsMatch in order to extract
difference between two PsiBinaryExpression
- using BoolUtils.findNegation to properly deduce the sign of the equals
clause
- restoring comments while replacing substring with charAt
- properly handling special characters (e.g. '\\', '\n', '\"', etc.) in
equals clause when it is converted to charAt + "=="
- eliminating the imperative form of a message for the inspection of
substring + equals

Signed-off-by: Nikita Eshkeev <nikita.eshkeev@jetbrains.com>

GitOrigin-RevId: be1dfd53a6af10979485cd172af39653faafb744
2020-04-17 22:57:24 +00:00