mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Java: minor simplification
GitOrigin-RevId: 1f89f4d381d96f720d04226b49730a09676c6379
This commit is contained in:
committed by
intellij-monorepo-bot
parent
8197993737
commit
135bd98b37
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.siyeh.ig.redundancy;
|
||||
|
||||
import com.intellij.codeInsight.BlockUtils;
|
||||
@@ -1212,19 +1212,15 @@ public final class RedundantStringOperationInspection extends AbstractBaseJavaLo
|
||||
if (!(parent instanceof PsiReferenceExpression ref)) {
|
||||
return;
|
||||
}
|
||||
PsiElement grandParent = parent.getParent();
|
||||
if (!(grandParent instanceof PsiMethodCallExpression)) {
|
||||
return;
|
||||
}
|
||||
PsiElement greatGrandParent = grandParent.getParent();
|
||||
if (!(greatGrandParent instanceof PsiReferenceExpression)) {
|
||||
return;
|
||||
}
|
||||
PsiExpression qualifier = ref.getQualifierExpression();
|
||||
if (qualifier == null) {
|
||||
return;
|
||||
}
|
||||
new CommentTracker().replaceAndRestoreComments(greatGrandParent, qualifier.getText() + ".length()");
|
||||
PsiElement grandParent = parent.getParent();
|
||||
if (!(grandParent instanceof PsiMethodCallExpression) || !(grandParent.getParent() instanceof PsiReferenceExpression toArrayCall)) {
|
||||
return;
|
||||
}
|
||||
new CommentTracker().replaceAndRestoreComments(toArrayCall, qualifier.getText() + ".length()");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user