Really fixed AssertThatGuavaOptional inspections to avoid conversions from .get() to .contains() for array types.
This commit is contained in:
+1
-1
@@ -108,7 +108,7 @@ class AssertThatCollectionOrMapExpressionInspection : AbstractAssertJInspection(
|
||||
expectedCallExpression,
|
||||
assertThatArgument,
|
||||
MethodNames.DOES_NOT_CONTAIN_KEY + "/" + MethodNames.CONTAINS_ENTRY
|
||||
) { desc ->
|
||||
) { _ ->
|
||||
listOf(
|
||||
MoveOutMethodCallExpressionQuickFix(
|
||||
"Remove get() of actual expression and use assertThat().doesNotContainKey() instead (regular map)",
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ class AssertThatGuavaOptionalInspection : AbstractAssertJInspection() {
|
||||
val actualExpression = staticMethodCall.firstArg as? PsiMethodCallExpression ?: return
|
||||
val outmostMethodCall = statement.findOutmostMethodCall() ?: return
|
||||
if (GUAVA_OPTIONAL_GET.test(actualExpression)) {
|
||||
if (actualExpression.resolveMethod()?.returnType is PsiArrayType) return
|
||||
if (actualExpression.type is PsiArrayType) return
|
||||
val expectedCallExpression = staticMethodCall.gatherAssertionCalls().singleOrNull() ?: return
|
||||
if (CallMatcher.anyOf(IS_EQUAL_TO_OBJECT, IS_EQUAL_TO_STRING).test(expectedCallExpression)) {
|
||||
registerMoveOutMethod(holder, outmostMethodCall, actualExpression, MethodNames.CONTAINS) { desc, method ->
|
||||
|
||||
Reference in New Issue
Block a user