From 236e2e06a2c4f85733b5e10396108b22e6622ebc Mon Sep 17 00:00:00 2001 From: Pavel Dolgov Date: Tue, 12 Jul 2016 17:47:37 +0300 Subject: [PATCH] Java inspection: Removed the "Add Braces" intention, because it can be replaced with "Control flow statement without braces" inspection (IDEA-157727) --- .../src/META-INF/IntentionPowerPack.xml | 5 -- .../siyeh/IntentionPowerPackBundle.properties | 2 - .../siyeh/ipp/braces/AddBracesIntention.java | 51 ------------------- .../AddBracesIntention/after.java.template | 8 --- .../AddBracesIntention/before.java.template | 6 --- .../AddBracesIntention/description.html | 6 --- 6 files changed, 78 deletions(-) delete mode 100644 plugins/IntentionPowerPak/src/com/siyeh/ipp/braces/AddBracesIntention.java delete mode 100644 plugins/IntentionPowerPak/src/intentionDescriptions/AddBracesIntention/after.java.template delete mode 100644 plugins/IntentionPowerPak/src/intentionDescriptions/AddBracesIntention/before.java.template delete mode 100644 plugins/IntentionPowerPak/src/intentionDescriptions/AddBracesIntention/description.html diff --git a/plugins/IntentionPowerPak/src/META-INF/IntentionPowerPack.xml b/plugins/IntentionPowerPak/src/META-INF/IntentionPowerPack.xml index f53563be74fe..9ed5d7fa3a5d 100644 --- a/plugins/IntentionPowerPak/src/META-INF/IntentionPowerPack.xml +++ b/plugins/IntentionPowerPak/src/META-INF/IntentionPowerPack.xml @@ -351,11 +351,6 @@ com.siyeh.IntentionPowerPackBundle intention.category.control.flow - - com.siyeh.ipp.braces.AddBracesIntention - com.siyeh.IntentionPowerPackBundle - intention.category.control.flow - com.siyeh.ipp.braces.RemoveBracesIntention com.siyeh.IntentionPowerPackBundle diff --git a/plugins/IntentionPowerPak/src/com/siyeh/IntentionPowerPackBundle.properties b/plugins/IntentionPowerPak/src/com/siyeh/IntentionPowerPackBundle.properties index 17284cd00e7f..30b6f9c3a113 100644 --- a/plugins/IntentionPowerPak/src/com/siyeh/IntentionPowerPackBundle.properties +++ b/plugins/IntentionPowerPak/src/com/siyeh/IntentionPowerPackBundle.properties @@ -90,7 +90,6 @@ flip.comparison.intention.family.name=Flip Comparison flip.conjunction.intention.family.name=Flip Conjunction Operands negate.comparison.intention.family.name=Negate Comparison remove.braces.intention.family.name=Remove Braces -add.braces.intention.family.name=Add Braces flip.commutative.method.call.intention.family.name=Flip Commutative Method Call constant.subexpression.intention.family.name=Compute Constant Value for Subexpression extract.increment.intention.family.name=Extract Increment @@ -172,7 +171,6 @@ flip.smth.intention.name1=Flip ''{0}'' (changes semantics) flip.comparison.intention.name=Flip ''{0}'' to ''{1}'' negate.comparison.intention.name=Negate ''{0}'' negate.comparison.intention.name1=Negate ''{0}'' to ''{1}'' -add.braces.intention.name=Add braces to ''{0}'' statement remove.braces.intention.name=Remove braces from ''{0}'' statement flip.commutative.method.call.intention.name=Flip ''.{0}()'' flip.commutative.method.call.intention.name1=Flip ''.{0}()'' (may change semantics) diff --git a/plugins/IntentionPowerPak/src/com/siyeh/ipp/braces/AddBracesIntention.java b/plugins/IntentionPowerPak/src/com/siyeh/ipp/braces/AddBracesIntention.java deleted file mode 100644 index f51759f6a171..000000000000 --- a/plugins/IntentionPowerPak/src/com/siyeh/ipp/braces/AddBracesIntention.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2003-2006 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.braces; - -import com.intellij.psi.*; -import com.intellij.util.IncorrectOperationException; -import com.siyeh.ig.PsiReplacementUtil; -import com.siyeh.ipp.base.PsiElementPredicate; -import org.jetbrains.annotations.NotNull; - -public class AddBracesIntention extends BaseBracesIntention { - - @NotNull - protected PsiElementPredicate getElementPredicate() { - return new PsiElementPredicate() { - @Override - public boolean satisfiedBy(PsiElement element) { - final PsiStatement statement = getSurroundingStatement(element); - return statement != null && !(statement instanceof PsiBlockStatement); - } - }; - } - - @NotNull - @Override - protected String getMessageKey() { - return "add.braces.intention.name"; - } - - protected void processIntention(@NotNull PsiElement element) throws IncorrectOperationException { - final PsiStatement statement = getSurroundingStatement(element); - if (statement == null) { - return; - } - final String newStatement = "{\n" + statement.getText() + "\n}"; - PsiReplacementUtil.replaceStatement(statement, newStatement); - } -} \ No newline at end of file diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/AddBracesIntention/after.java.template b/plugins/IntentionPowerPak/src/intentionDescriptions/AddBracesIntention/after.java.template deleted file mode 100644 index 7777953c60cc..000000000000 --- a/plugins/IntentionPowerPak/src/intentionDescriptions/AddBracesIntention/after.java.template +++ /dev/null @@ -1,8 +0,0 @@ -public class X { - int f(boolean b) { - if (b) { - return 1; - } - return 0; - } -} \ No newline at end of file diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/AddBracesIntention/before.java.template b/plugins/IntentionPowerPak/src/intentionDescriptions/AddBracesIntention/before.java.template deleted file mode 100644 index d45dc00808ae..000000000000 --- a/plugins/IntentionPowerPak/src/intentionDescriptions/AddBracesIntention/before.java.template +++ /dev/null @@ -1,6 +0,0 @@ -public class X { - int f(boolean b) { - if (b) return 1; - return 0; - } -} \ No newline at end of file diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/AddBracesIntention/description.html b/plugins/IntentionPowerPak/src/intentionDescriptions/AddBracesIntention/description.html deleted file mode 100644 index fb832c3844f6..000000000000 --- a/plugins/IntentionPowerPak/src/intentionDescriptions/AddBracesIntention/description.html +++ /dev/null @@ -1,6 +0,0 @@ - - -This intention adds braces to control flow statements without -braces. - -