5 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
ce7dae26b1 [codeInsight] IDEA-240288 Inspection for StringBuilder.toString().substring()
This patch replaces the excessive extraction of a qualifier via `ExpressionUtils.getEffectiveQualifier` with a simple `call.getMethodExpression().getQualifierExpression`

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

GitOrigin-RevId: 4a4f1c6b218c63691fa2bd4610e9901874d3c712
2020-05-15 12:15:31 +00:00
Nikita Eshkeev
0218cec2c9 [codeInsight] IDEA-240288 Inspection for StringBuilder.toString().substring()
This patch removes the detection of redundant calls to `StringBuilder#toString` from the `RedundantStringOperationInspection` since there is a more general inspection called `UnnecessaryToStringCallInspection` which handles all the redundant `Object#toString` calls. All the related tests were moved to the test data of `UnnecessaryToStringCallInspectionTest`

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

GitOrigin-RevId: 1fe7723fa4369b797120c5bbc6a6b24947c84a94
2020-05-14 22:04:54 +00:00
Nikita Eshkeev
cb47b00f60 [codeInsight] IDEA-240288 Inspection for StringBuilder.toString().substring()
This patch alters the `getRedundantStringBuilderToStringProblem` method with more sophisticated algorithm to detect unnecessary freestanding `StringBuilder#toString` calls. If the call is a part of a polyadic expression it checks if there is at least one string operand (either a constant literal or a local variable or a constant variable or a method call) and based on that information it detects redundant `StringBuilder#toString` calls.

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

GitOrigin-RevId: e09ea8b8829ad9e28e8ff1bcfad34cf6b191aa6b
2020-05-12 00:59:21 +00:00
Nikita Eshkeev
597a92c0b2 [codeInsight] IDEA-240288 Inspection for StringBuilder.toString().substring()
This patch enhances RedundantStringOperationInspection with detecting either unnecessary naked calls StringBuilder.toString or redundant toString in StringBuilder.toString.substring.

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

GitOrigin-RevId: 3cd7e964c0acc73fb1ac38061ef31264035f82dc
2020-05-09 05:25:10 +00:00