mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-intentions] RemoveRedundantArgumentsFix: fix preview; enable when calling library methods
GitOrigin-RevId: b2c765ef889f3c3081ba1c14adcbece0863a0b77
This commit is contained in:
committed by
intellij-monorepo-bot
parent
fff9d4c42d
commit
5bb39a4c90
+3
-2
@@ -26,6 +26,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.psi.util.TypeConversionUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -125,7 +126,7 @@ public final class RemoveRedundantArgumentsFix implements IntentionAction {
|
||||
if (!candidate.isStaticsScopeCorrect()) return;
|
||||
PsiMethod method = (PsiMethod)candidate.getElement();
|
||||
PsiSubstitutor substitutor = candidate.getSubstitutor();
|
||||
if (method != null && BaseIntentionAction.canModify(method)) {
|
||||
if (method != null && BaseIntentionAction.canModify(arguments)) {
|
||||
QuickFixAction
|
||||
.registerQuickFixAction(highlightInfo, fixRange, new RemoveRedundantArgumentsFix(method, arguments.getExpressions(), substitutor));
|
||||
}
|
||||
@@ -134,7 +135,7 @@ public final class RemoveRedundantArgumentsFix implements IntentionAction {
|
||||
@Override
|
||||
public @NotNull FileModifier getFileModifierForPreview(@NotNull PsiFile target) {
|
||||
return new RemoveRedundantArgumentsFix(
|
||||
PsiTreeUtil.findSameElementInCopy(myTargetMethod, target),
|
||||
myTargetMethod,
|
||||
ContainerUtil.map2Array(myArguments, PsiExpression.class, arg -> PsiTreeUtil.findSameElementInCopy(arg, target)),
|
||||
mySubstitutor);
|
||||
}
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Remove redundant arguments to call 'trim()'" "true"
|
||||
class A {
|
||||
public A() {
|
||||
String s = "xyz".trim()
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Remove redundant arguments to call 'trim()'" "true"
|
||||
class A {
|
||||
public A() {
|
||||
String s = "xyz".trim("<caret>123")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user