Remove SimplifyIfElseIntention: superseded by TrivialIfInspection

GitOrigin-RevId: f60129358dcfc5cd9c4f1607d603cc9d1a7ed108
This commit is contained in:
Tagir Valeev
2019-11-25 07:46:32 +00:00
committed by intellij-monorepo-bot
parent e212f2024d
commit 4ca40ef118
8 changed files with 2 additions and 78 deletions
@@ -670,6 +670,7 @@ system.set.security.manager.display.name=Call to 'System.setSecurityManager()'
system.set.security.manager.problem.descriptor=Call to <code>System.#ref()</code> may pose security concerns #loc
control.flow.statement.without.braces.display.name=Control flow statement without braces
trivial.if.display.name=Redundant 'if' statement
trivial.if.fix.family.name=Simplify 'if else'
trivial.if.option.ignore.chained=Ignore chained 'if' statements
thread.with.default.run.method.display.name=Instantiating a Thread with default 'run()' method
while.loop.spins.on.field.display.name='while' loop spins on field
@@ -100,8 +100,7 @@ public class TrivialIfInspection extends BaseInspection implements CleanupLocalI
@Override
@NotNull
public String getFamilyName() {
return InspectionGadgetsBundle.message(
"constant.conditional.expression.simplify.quickfix");
return InspectionGadgetsBundle.message("trivial.if.fix.family.name");
}
@Override
@@ -211,11 +211,6 @@
<bundleName>com.siyeh.IntentionPowerPackBundle</bundleName>
<categoryKey>intention.category.control.flow</categoryKey>
</intentionAction>
<intentionAction>
<className>com.siyeh.ipp.trivialif.SimplifyIfElseIntention</className>
<bundleName>com.siyeh.IntentionPowerPackBundle</bundleName>
<categoryKey>intention.category.control.flow</categoryKey>
</intentionAction>
<intentionAction>
<className>com.siyeh.ipp.forloop.ReplaceForEachLoopWithIndexedForLoopIntention</className>
<bundleName>com.siyeh.IntentionPowerPackBundle</bundleName>
@@ -33,8 +33,6 @@ replace.switch.with.if.intention.family.name=Replace switch with if
constant.expression.intention.family.name=Compute constant value
create.assert.intention.name=Create JUnit assertion
create.assert.intention.family.name=Create JUnit assertion
simplify.if.else.intention.name=Simplify 'if else'
simplify.if.else.intention.family.name=Simplify if else
merge.if.or.intention.name=Merge sequential 'if's
merge.if.or.intention.family.name=Merge sequential ifs
merge.if.and.intention.name=Merge nested 'if's
@@ -1,51 +0,0 @@
/*
* Copyright 2003-2009 Dave Griffith, Bas Leijdekkers
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.siyeh.ipp.trivialif;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiIfStatement;
import com.intellij.psi.PsiJavaToken;
import com.siyeh.ig.controlflow.TrivialIfInspection;
import com.siyeh.ipp.base.Intention;
import com.siyeh.ipp.base.PsiElementPredicate;
import org.jetbrains.annotations.NotNull;
public class SimplifyIfElseIntention extends Intention {
@Override
@NotNull
public PsiElementPredicate getElementPredicate() {
return new PsiElementPredicate() {
@Override
public boolean satisfiedBy(PsiElement element) {
if (!(element instanceof PsiJavaToken)) {
return false;
}
final PsiJavaToken token = (PsiJavaToken)element;
final PsiElement parent = token.getParent();
if (!(parent instanceof PsiIfStatement)) {
return false;
}
return TrivialIfInspection.isTrivial((PsiIfStatement)parent);
}
};
}
@Override
public void processIntention(@NotNull PsiElement element) {
TrivialIfInspection.simplify((PsiIfStatement)element.getParent());
}
}
@@ -1,5 +0,0 @@
public class X {
boolean f(boolean a) {
return a;
}
}
@@ -1,8 +0,0 @@
public class X {
boolean f(boolean a) {
<spot>if</spot> (a) {
return true;
}
return false;
}
}
@@ -1,5 +0,0 @@
<html>
<body>
Simplifies an unnecessary <b>if-else</b> statement.
</body>
</html>