From 4ca40ef118e244397635d355a32a7c7953ceb478 Mon Sep 17 00:00:00 2001 From: Tagir Valeev Date: Mon, 25 Nov 2019 10:56:45 +0700 Subject: [PATCH] Remove SimplifyIfElseIntention: superseded by TrivialIfInspection GitOrigin-RevId: f60129358dcfc5cd9c4f1607d603cc9d1a7ed108 --- .../siyeh/InspectionGadgetsBundle.properties | 1 + .../ig/controlflow/TrivialIfInspection.java | 3 +- .../src/META-INF/IntentionPowerPack.xml | 5 -- .../siyeh/IntentionPowerPackBundle.properties | 2 - .../trivialif/SimplifyIfElseIntention.java | 51 ------------------- .../after.java.template | 5 -- .../before.java.template | 8 --- .../SimplifyIfElseIntention/description.html | 5 -- 8 files changed, 2 insertions(+), 78 deletions(-) delete mode 100644 plugins/IntentionPowerPak/src/com/siyeh/ipp/trivialif/SimplifyIfElseIntention.java delete mode 100644 plugins/IntentionPowerPak/src/intentionDescriptions/SimplifyIfElseIntention/after.java.template delete mode 100644 plugins/IntentionPowerPak/src/intentionDescriptions/SimplifyIfElseIntention/before.java.template delete mode 100644 plugins/IntentionPowerPak/src/intentionDescriptions/SimplifyIfElseIntention/description.html diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/InspectionGadgetsBundle.properties b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/InspectionGadgetsBundle.properties index 1772ac42a5b8..1f1b2cd2933c 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/InspectionGadgetsBundle.properties +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/InspectionGadgetsBundle.properties @@ -670,6 +670,7 @@ system.set.security.manager.display.name=Call to 'System.setSecurityManager()' system.set.security.manager.problem.descriptor=Call to System.#ref() 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 diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/controlflow/TrivialIfInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/controlflow/TrivialIfInspection.java index 2e2622e6b2b4..33678f904d69 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/controlflow/TrivialIfInspection.java +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/controlflow/TrivialIfInspection.java @@ -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 diff --git a/plugins/IntentionPowerPak/src/META-INF/IntentionPowerPack.xml b/plugins/IntentionPowerPak/src/META-INF/IntentionPowerPack.xml index e86cfacccf44..d0f5567d8c54 100644 --- a/plugins/IntentionPowerPak/src/META-INF/IntentionPowerPack.xml +++ b/plugins/IntentionPowerPak/src/META-INF/IntentionPowerPack.xml @@ -211,11 +211,6 @@ com.siyeh.IntentionPowerPackBundle intention.category.control.flow - - com.siyeh.ipp.trivialif.SimplifyIfElseIntention - com.siyeh.IntentionPowerPackBundle - intention.category.control.flow - com.siyeh.ipp.forloop.ReplaceForEachLoopWithIndexedForLoopIntention com.siyeh.IntentionPowerPackBundle diff --git a/plugins/IntentionPowerPak/src/com/siyeh/IntentionPowerPackBundle.properties b/plugins/IntentionPowerPak/src/com/siyeh/IntentionPowerPackBundle.properties index 9397ec464473..89c3c43d4d53 100644 --- a/plugins/IntentionPowerPak/src/com/siyeh/IntentionPowerPackBundle.properties +++ b/plugins/IntentionPowerPak/src/com/siyeh/IntentionPowerPackBundle.properties @@ -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 diff --git a/plugins/IntentionPowerPak/src/com/siyeh/ipp/trivialif/SimplifyIfElseIntention.java b/plugins/IntentionPowerPak/src/com/siyeh/ipp/trivialif/SimplifyIfElseIntention.java deleted file mode 100644 index b5a3f776d83d..000000000000 --- a/plugins/IntentionPowerPak/src/com/siyeh/ipp/trivialif/SimplifyIfElseIntention.java +++ /dev/null @@ -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()); - } -} \ No newline at end of file diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/SimplifyIfElseIntention/after.java.template b/plugins/IntentionPowerPak/src/intentionDescriptions/SimplifyIfElseIntention/after.java.template deleted file mode 100644 index 286b7f258199..000000000000 --- a/plugins/IntentionPowerPak/src/intentionDescriptions/SimplifyIfElseIntention/after.java.template +++ /dev/null @@ -1,5 +0,0 @@ -public class X { - boolean f(boolean a) { - return a; - } -} \ No newline at end of file diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/SimplifyIfElseIntention/before.java.template b/plugins/IntentionPowerPak/src/intentionDescriptions/SimplifyIfElseIntention/before.java.template deleted file mode 100644 index c23f51396417..000000000000 --- a/plugins/IntentionPowerPak/src/intentionDescriptions/SimplifyIfElseIntention/before.java.template +++ /dev/null @@ -1,8 +0,0 @@ -public class X { - boolean f(boolean a) { - if (a) { - return true; - } - return false; - } -} \ No newline at end of file diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/SimplifyIfElseIntention/description.html b/plugins/IntentionPowerPak/src/intentionDescriptions/SimplifyIfElseIntention/description.html deleted file mode 100644 index 5ef835f599a4..000000000000 --- a/plugins/IntentionPowerPak/src/intentionDescriptions/SimplifyIfElseIntention/description.html +++ /dev/null @@ -1,5 +0,0 @@ - - -Simplifies an unnecessary if-else statement. - -