mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup: @Override
This commit is contained in:
+3
@@ -25,12 +25,14 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class ClassReferencesSubclassInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"class.references.subclass.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
final PsiNamedElement element = (PsiNamedElement)infos[0];
|
||||
@@ -46,6 +48,7 @@ public class ClassReferencesSubclassInspection extends BaseInspection {
|
||||
containingClassName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new ClassReferencesSubclassVisitor();
|
||||
}
|
||||
|
||||
+1
@@ -101,6 +101,7 @@ public class DeclareCollectionAsInterfaceInspection extends BaseInspection {
|
||||
this.typeString = typeString;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
|
||||
@@ -24,16 +24,19 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class InstanceofThisInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message("instanceof.check.for.this.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message("instanceof.check.for.this.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new InstanceofThisVisitor();
|
||||
}
|
||||
|
||||
+1
@@ -70,6 +70,7 @@ public class OverlyStrongTypeCastInspection extends BaseInspection {
|
||||
|
||||
private static class OverlyStrongCastFix extends InspectionGadgetsFix {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
|
||||
+1
-1
@@ -21,7 +21,6 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.search.searches.OverridingMethodsSearch;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.Query;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
import com.siyeh.ig.BaseInspection;
|
||||
@@ -123,6 +122,7 @@ public class TypeMayBeWeakenedInspection extends BaseInspection {
|
||||
this.fqClassName = fqClassName;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message("type.may.be.weakened.quickfix", fqClassName);
|
||||
|
||||
+6
-1
@@ -15,10 +15,10 @@
|
||||
*/
|
||||
package com.siyeh.ig.assignment;
|
||||
|
||||
import com.intellij.codeInspection.ui.SingleCheckboxOptionsPanel;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.codeInspection.ui.SingleCheckboxOptionsPanel;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
import com.siyeh.ig.BaseInspection;
|
||||
import com.siyeh.ig.BaseInspectionVisitor;
|
||||
@@ -36,17 +36,20 @@ public class AssignmentToCollectionFieldFromParameterInspection
|
||||
*/
|
||||
public boolean ignorePrivateMethods = true;
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getID() {
|
||||
return "AssignmentToCollectionOrArrayFieldFromParameter";
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"assignment.collection.array.field.from.parameter.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
final PsiExpression rhs = (PsiExpression)infos[0];
|
||||
@@ -64,6 +67,7 @@ public class AssignmentToCollectionFieldFromParameterInspection
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public JComponent createOptionsPanel() {
|
||||
return new SingleCheckboxOptionsPanel(
|
||||
@@ -72,6 +76,7 @@ public class AssignmentToCollectionFieldFromParameterInspection
|
||||
"ignorePrivateMethods");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new AssignmentToCollectionFieldFromParameterVisitor();
|
||||
}
|
||||
|
||||
+3
@@ -27,18 +27,21 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class AssignmentToStaticFieldFromInstanceMethodInspection
|
||||
extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"assignment.to.static.field.from.instance.method.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"assignment.to.static.field.from.instance.method.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new AssignmentToStaticFieldFromInstanceMethod();
|
||||
}
|
||||
|
||||
+6
@@ -28,18 +28,21 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class AssignmentUsedAsConditionInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"assignment.used.as.condition.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"assignment.used.as.condition.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public InspectionGadgetsFix buildFix(Object... infos) {
|
||||
return new AssignmentUsedAsConditionFix();
|
||||
}
|
||||
@@ -47,12 +50,14 @@ public class AssignmentUsedAsConditionInspection extends BaseInspection {
|
||||
private static class AssignmentUsedAsConditionFix
|
||||
extends InspectionGadgetsFix {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"assignment.used.as.condition.replace.quickfix");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFix(Project project, ProblemDescriptor descriptor)
|
||||
throws IncorrectOperationException {
|
||||
final PsiAssignmentExpression expression =
|
||||
@@ -66,6 +71,7 @@ public class AssignmentUsedAsConditionInspection extends BaseInspection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new AssignmentUsedAsConditionVisitor();
|
||||
}
|
||||
|
||||
+1
@@ -97,6 +97,7 @@ public class IncrementDecrementUsedAsExpressionInspection
|
||||
this.elementText = elementText;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
|
||||
@@ -26,18 +26,21 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class NestedAssignmentInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"nested.assignment.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"nested.assignment.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new NestedAssignmentVisitor();
|
||||
}
|
||||
|
||||
+1
@@ -136,6 +136,7 @@ public class ReplaceAssignmentWithOperatorAssignmentInspection extends BaseInspe
|
||||
signText);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return m_name;
|
||||
|
||||
+1
@@ -169,6 +169,7 @@ public class PointlessBitwiseExpressionInspection extends BaseInspection {
|
||||
|
||||
private class PointlessBitwiseFix extends InspectionGadgetsFix {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
|
||||
@@ -72,6 +72,7 @@ public class ShiftOutOfRangeInspection extends BaseInspection {
|
||||
this.isLong = isLong;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
final int newValue;
|
||||
|
||||
+2
@@ -70,6 +70,7 @@ public class ArchaicSystemPropertyAccessInspection extends BaseInspection {
|
||||
|
||||
private static class ReplaceWithParseMethodFix extends InspectionGadgetsFix {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
@@ -106,6 +107,7 @@ public class ArchaicSystemPropertyAccessInspection extends BaseInspection {
|
||||
private static class ReplaceWithStandardPropertyAccessFix
|
||||
extends InspectionGadgetsFix {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
|
||||
@@ -24,7 +24,6 @@ import com.siyeh.InspectionGadgetsBundle;
|
||||
import com.siyeh.ig.BaseInspection;
|
||||
import com.siyeh.ig.BaseInspectionVisitor;
|
||||
import com.siyeh.ig.InspectionGadgetsFix;
|
||||
import com.siyeh.ig.psiutils.MethodCallUtils;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -69,6 +68,7 @@ public class ArrayEqualsInspection extends BaseInspection {
|
||||
this.deepEquals = deepEquals;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
if (deepEquals) {
|
||||
|
||||
@@ -66,6 +66,7 @@ public class ArrayHashCodeInspection extends BaseInspection {
|
||||
this.deepHashCode = deepHashCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
if (deepHashCode) {
|
||||
|
||||
+2
@@ -208,6 +208,7 @@ public class CastConflictsWithInstanceofInspection extends BaseInspection {
|
||||
myCastType = castType;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message("cast.conflicts.with.instanceof.quickfix1", myCastType, myInstanceofType);
|
||||
@@ -229,6 +230,7 @@ public class CastConflictsWithInstanceofInspection extends BaseInspection {
|
||||
myCastType = castType;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message("cast.conflicts.with.instanceof.quickfix2", myInstanceofType, myCastType);
|
||||
|
||||
+3
@@ -24,18 +24,21 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class CastToIncompatibleInterfaceInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"casting.to.incompatible.interface.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"casting.to.incompatible.interface.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new CastToIncompatibleInterfaceVisitor();
|
||||
}
|
||||
|
||||
@@ -22,16 +22,16 @@ import com.intellij.psi.codeStyle.JavaCodeStyleManager;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
import com.siyeh.ig.BaseInspection;
|
||||
import com.siyeh.ig.BaseInspectionVisitor;
|
||||
import com.siyeh.ig.InspectionGadgetsFix;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class ClassNewInstanceInspection extends BaseInspection {
|
||||
|
||||
@@ -57,6 +57,7 @@ public class ClassNewInstanceInspection extends BaseInspection {
|
||||
|
||||
private static class ClassNewInstanceFix extends InspectionGadgetsFix {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
|
||||
+4
@@ -28,24 +28,28 @@ import org.jetbrains.annotations.Nullable;
|
||||
public class CompareToUsesNonFinalVariableInspection
|
||||
extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"non.final.field.compareto.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"non.final.field.compareto.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected InspectionGadgetsFix buildFix(Object... infos) {
|
||||
final PsiField field = (PsiField)infos[0];
|
||||
return MakeFieldFinalFix.buildFix(field);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new CompareToUsesNonFinalVariableVisitor();
|
||||
}
|
||||
|
||||
@@ -25,18 +25,21 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class CovariantEqualsInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"covariant.equals.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"covariant.equals.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new CovariantEqualsVisitor();
|
||||
}
|
||||
|
||||
@@ -30,35 +30,41 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class EmptyInitializerInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getID() {
|
||||
return "EmptyClassInitializer";
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"empty.class.initializer.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"empty.class.initializer.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InspectionGadgetsFix buildFix(Object... infos) {
|
||||
return new EmptyInitializerFix();
|
||||
}
|
||||
|
||||
private static class EmptyInitializerFix extends InspectionGadgetsFix {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"empty.class.initializer.delete.quickfix");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFix(Project project, ProblemDescriptor descriptor)
|
||||
throws IncorrectOperationException {
|
||||
final PsiElement element = descriptor.getPsiElement();
|
||||
@@ -70,6 +76,7 @@ public class EmptyInitializerInspection extends BaseInspection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new EmptyInitializerVisitor();
|
||||
}
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
*/
|
||||
package com.siyeh.ig.bugs;
|
||||
|
||||
import com.intellij.codeInspection.ui.SingleCheckboxOptionsPanel;
|
||||
import com.intellij.psi.*;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
import com.siyeh.ig.BaseInspection;
|
||||
import com.siyeh.ig.BaseInspectionVisitor;
|
||||
import com.intellij.codeInspection.ui.SingleCheckboxOptionsPanel;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -31,30 +31,36 @@ public class EmptyStatementBodyInspection extends BaseInspection {
|
||||
*/
|
||||
public boolean m_reportEmptyBlocks = true;
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getID() {
|
||||
return "StatementWithEmptyBody";
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message("statement.with.empty.body.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message("statement.with.empty.body.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabledByDefault() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JComponent createOptionsPanel() {
|
||||
return new SingleCheckboxOptionsPanel(InspectionGadgetsBundle.message("statement.with.empty.body.include.option"),
|
||||
this, "m_reportEmptyBlocks");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new EmptyStatementVisitor();
|
||||
}
|
||||
|
||||
+6
-2
@@ -26,12 +26,14 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class EqualsBetweenInconvertibleTypesInspection
|
||||
extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"equals.between.inconvertible.types.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
final PsiType comparedType = (PsiType)infos[0];
|
||||
@@ -42,10 +44,12 @@ public class EqualsBetweenInconvertibleTypesInspection
|
||||
comparisonType.getPresentableText());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabledByDefault() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new EqualsBetweenInconvertibleTypesVisitor();
|
||||
}
|
||||
@@ -83,8 +87,8 @@ public class EqualsBetweenInconvertibleTypesInspection
|
||||
}
|
||||
final PsiType comparedTypeErasure = TypeConversionUtil.erasure(comparedType);
|
||||
final PsiType comparisonTypeErasure = TypeConversionUtil.erasure(comparisonType);
|
||||
if (comparedTypeErasure == null ||
|
||||
comparisonTypeErasure == null ||
|
||||
if (comparedTypeErasure == null ||
|
||||
comparisonTypeErasure == null ||
|
||||
TypeConversionUtil.areTypesConvertible(comparedTypeErasure, comparisonTypeErasure)) {
|
||||
return;
|
||||
}
|
||||
|
||||
+5
@@ -27,29 +27,34 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class EqualsUsesNonFinalVariableInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getID() {
|
||||
return "NonFinalFieldReferenceInEquals";
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"non.final.field.in.equals.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"non.final.field.in.equals.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected InspectionGadgetsFix buildFix(Object... infos) {
|
||||
final PsiField field = (PsiField)infos[0];
|
||||
return MakeFieldFinalFix.buildFix(field);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new EqualsUsesNonFinalVariableVisitor();
|
||||
}
|
||||
|
||||
+3
@@ -24,12 +24,14 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class ForLoopThatDoesntUseLoopVariableInspection
|
||||
extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"for.loop.not.use.loop.variable.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
final boolean condition = ((Boolean)infos[0]).booleanValue();
|
||||
@@ -46,6 +48,7 @@ public class ForLoopThatDoesntUseLoopVariableInspection
|
||||
"for.loop.not.use.loop.variable.problem.descriptor.update");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new ForLoopThatDoesntUseLoopVariableVisitor();
|
||||
}
|
||||
|
||||
@@ -172,10 +172,12 @@ class FormatDecode {
|
||||
|
||||
private static class AllValidator implements Validator {
|
||||
|
||||
@Override
|
||||
public boolean valid(PsiType type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String type() {
|
||||
return "any";
|
||||
}
|
||||
@@ -183,6 +185,7 @@ class FormatDecode {
|
||||
|
||||
private static class DateValidator implements Validator {
|
||||
|
||||
@Override
|
||||
public boolean valid(PsiType type) {
|
||||
final String text = type.getCanonicalText();
|
||||
|
||||
@@ -192,6 +195,7 @@ class FormatDecode {
|
||||
CommonClassNames.JAVA_UTIL_CALENDAR.equals(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String type() {
|
||||
return "Date/Time";
|
||||
}
|
||||
@@ -199,12 +203,14 @@ class FormatDecode {
|
||||
|
||||
private static class CharValidator implements Validator {
|
||||
|
||||
@Override
|
||||
public boolean valid(PsiType type) {
|
||||
final String text = type.getCanonicalText();
|
||||
return PsiType.CHAR.equals(type) ||
|
||||
CommonClassNames.JAVA_LANG_CHARACTER.equals(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String type() {
|
||||
return "char";
|
||||
}
|
||||
@@ -212,6 +218,7 @@ class FormatDecode {
|
||||
|
||||
private static class IntValidator implements Validator {
|
||||
|
||||
@Override
|
||||
public boolean valid(PsiType type) {
|
||||
final String text = type.getCanonicalText();
|
||||
return PsiType.INT.equals(type) ||
|
||||
@@ -225,6 +232,7 @@ class FormatDecode {
|
||||
"java.math.BigInteger".equals(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String type() {
|
||||
return "integer type";
|
||||
}
|
||||
@@ -232,6 +240,7 @@ class FormatDecode {
|
||||
|
||||
private static class FloatValidator implements Validator {
|
||||
|
||||
@Override
|
||||
public boolean valid(PsiType type) {
|
||||
final String text = type.getCanonicalText();
|
||||
return PsiType.DOUBLE.equals(type) ||
|
||||
@@ -241,6 +250,7 @@ class FormatDecode {
|
||||
"java.math.BigDecimal".equals(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String type() {
|
||||
return "floating point";
|
||||
}
|
||||
|
||||
+5
@@ -28,29 +28,34 @@ import org.jetbrains.annotations.Nullable;
|
||||
public class HashCodeUsesNonFinalVariableInspection
|
||||
extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getID() {
|
||||
return "NonFinalFieldReferencedInHashCode";
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"non.final.field.in.hashcode.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"non.final.field.in.hashcode.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected InspectionGadgetsFix buildFix(Object... infos) {
|
||||
final PsiField field = (PsiField)infos[0];
|
||||
return MakeFieldFinalFix.buildFix(field);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new HashCodeUsesNonFinalVariableVisitor();
|
||||
}
|
||||
|
||||
@@ -86,6 +86,7 @@ public class ImplicitArrayToStringInspection extends BaseInspection {
|
||||
this.removeToString = removeToString;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
@NonNls final String expressionText;
|
||||
|
||||
+3
@@ -25,18 +25,21 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class InstanceofIncompatibleInterfaceInspection
|
||||
extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"instanceof.with.incompatible.interface.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"instanceof.with.incompatible.interface.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new InstanceofIncompatibleInterfaceVisitor();
|
||||
}
|
||||
|
||||
+3
@@ -27,18 +27,21 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class InstantiationOfUtilityClassInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"instantiation.utility.class.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"instantiation.utility.class.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new InstantiationOfUtilityClassVisitor();
|
||||
}
|
||||
|
||||
+3
@@ -29,18 +29,21 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class IteratorHasNextCallsIteratorNextInspection
|
||||
extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"iterator.hasnext.which.calls.next.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"iterator.hasnext.which.calls.next.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new IteratorHasNextCallsIteratorNext();
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ public class MathRandomCastToIntInspection extends BaseInspection {
|
||||
}
|
||||
|
||||
private static class MathRandomCastToIntegerFix extends InspectionGadgetsFix {
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
|
||||
@@ -28,22 +28,26 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class MisspelledCompareToInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"misspelled.compareto.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"misspelled.compareto.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InspectionGadgetsFix buildFix(Object... infos) {
|
||||
return new RenameFix(HardcodedMethodConstants.COMPARE_TO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new MisspelledCompareToVisitor();
|
||||
}
|
||||
|
||||
@@ -28,22 +28,26 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class MisspelledEqualsInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"misspelled.equals.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"misspelled.equals.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InspectionGadgetsFix buildFix(Object... infos) {
|
||||
return new RenameFix(HardcodedMethodConstants.EQUALS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new MisspelledEqualsVisitor();
|
||||
}
|
||||
|
||||
@@ -28,22 +28,26 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class MisspelledHashcodeInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"misspelled.hashcode.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"misspelled.hashcode.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InspectionGadgetsFix buildFix(Object... infos) {
|
||||
return new RenameFix(HardcodedMethodConstants.HASH_CODE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new MisspelledHashcodeVisitor();
|
||||
}
|
||||
|
||||
@@ -28,22 +28,26 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class MisspelledToStringInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"misspelled.tostring.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"misspelled.tostring.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InspectionGadgetsFix buildFix(Object... infos) {
|
||||
return new RenameFix(HardcodedMethodConstants.TO_STRING);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new MisspelledToStringVisitor();
|
||||
}
|
||||
|
||||
+1
@@ -63,6 +63,7 @@ public class NewStringBufferWithCharArgumentInspection extends BaseInspection {
|
||||
private static class NewStringBufferWithCharArgumentFix
|
||||
extends InspectionGadgetsFix {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
|
||||
+11
-1
@@ -17,7 +17,10 @@ package com.siyeh.ig.bugs;
|
||||
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.JavaTokenType;
|
||||
import com.intellij.psi.PsiExpression;
|
||||
import com.intellij.psi.PsiPolyadicExpression;
|
||||
import com.intellij.psi.PsiType;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
@@ -28,21 +31,25 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class NonShortCircuitBooleanInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getID() {
|
||||
return "NonShortCircuitBooleanExpression";
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message("non.short.circuit.boolean.expression.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message("non.short.circuit.boolean.expression.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public InspectionGadgetsFix buildFix(Object... infos) {
|
||||
return new NonShortCircuitBooleanFix();
|
||||
}
|
||||
@@ -50,11 +57,13 @@ public class NonShortCircuitBooleanInspection extends BaseInspection {
|
||||
private static class NonShortCircuitBooleanFix
|
||||
extends InspectionGadgetsFix {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message("non.short.circuit.boolean.expression.replace.quickfix");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFix(Project project, ProblemDescriptor descriptor) throws IncorrectOperationException {
|
||||
final PsiPolyadicExpression expression = (PsiPolyadicExpression)descriptor.getPsiElement();
|
||||
final IElementType tokenType = expression.getOperationTokenType();
|
||||
@@ -80,6 +89,7 @@ public class NonShortCircuitBooleanInspection extends BaseInspection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new NonShortCircuitBooleanVisitor();
|
||||
}
|
||||
|
||||
+4
@@ -26,22 +26,26 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class NullArgumentToVariableArgMethodInspection
|
||||
extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"null.argument.to.var.arg.method.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"null.argument.to.var.arg.method.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabledByDefault() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new NullArgumentToVariableArgVisitor();
|
||||
}
|
||||
|
||||
@@ -143,6 +143,7 @@ public class ObjectEqualityInspection extends BaseInspection {
|
||||
final PsiElementProcessor.CollectElementsWithLimit<PsiClass> processor = new PsiElementProcessor.CollectElementsWithLimit(6);
|
||||
final ProgressManager progressManager = ProgressManager.getInstance();
|
||||
progressManager.runProcess(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ClassInheritorsSearch.search(aClass, scope, true, true).forEach(new PsiElementProcessorAdapter<PsiClass>(processor));
|
||||
}
|
||||
|
||||
@@ -27,22 +27,26 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ObjectEqualsNullInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"object.equals.null.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"object.equals.null.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabledByDefault() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new ObjectEqualsNullVisitor();
|
||||
}
|
||||
|
||||
+3
@@ -25,16 +25,19 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ResultOfObjectAllocationIgnoredInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message("result.of.object.allocation.ignored.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message("result.of.object.allocation.ignored.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new ResultOfObjectAllocationIgnoredVisitor();
|
||||
}
|
||||
|
||||
@@ -28,17 +28,20 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class StaticCallOnSubclassInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getID() {
|
||||
return "StaticMethodReferencedViaSubclass";
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"static.method.via.subclass.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
final PsiClass declaringClass = (PsiClass)infos[0];
|
||||
@@ -48,18 +51,21 @@ public class StaticCallOnSubclassInspection extends BaseInspection {
|
||||
declaringClass.getQualifiedName(), referencedClass.getQualifiedName());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InspectionGadgetsFix buildFix(Object... infos) {
|
||||
return new StaticCallOnSubclassFix();
|
||||
}
|
||||
|
||||
private static class StaticCallOnSubclassFix extends InspectionGadgetsFix {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"static.method.via.subclass.rationalize.quickfix");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFix(Project project, ProblemDescriptor descriptor)
|
||||
throws IncorrectOperationException {
|
||||
final PsiIdentifier name =
|
||||
@@ -92,6 +98,7 @@ public class StaticCallOnSubclassInspection extends BaseInspection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new StaticCallOnSubclassVisitor();
|
||||
}
|
||||
|
||||
+7
@@ -29,17 +29,20 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class StaticFieldReferenceOnSubclassInspection
|
||||
extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getID() {
|
||||
return "StaticFieldReferencedViaSubclass";
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"static.field.via.subclass.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
final PsiClass declaringClass = (PsiClass)infos[0];
|
||||
@@ -50,18 +53,21 @@ public class StaticFieldReferenceOnSubclassInspection
|
||||
referencedClass.getQualifiedName());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InspectionGadgetsFix buildFix(Object... infos) {
|
||||
return new StaticFieldOnSubclassFix();
|
||||
}
|
||||
|
||||
private static class StaticFieldOnSubclassFix extends InspectionGadgetsFix {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"static.field.via.subclass.rationalize.quickfix");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFix(Project project, ProblemDescriptor descriptor)
|
||||
throws IncorrectOperationException {
|
||||
final PsiIdentifier name =
|
||||
@@ -75,6 +81,7 @@ public class StaticFieldReferenceOnSubclassInspection
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new StaticFieldOnSubclassVisitor();
|
||||
}
|
||||
|
||||
+1
@@ -57,6 +57,7 @@ public class StringConcatenationInFormatCallInspection extends BaseInspection {
|
||||
myPlural = plural;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
if (myPlural) {
|
||||
|
||||
+1
@@ -61,6 +61,7 @@ public class StringConcatenationInMessageFormatCallInspection extends BaseInspec
|
||||
this.variableName = variableName;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message("string.concatenation.in.format.call.quickfix", variableName);
|
||||
|
||||
@@ -15,7 +15,10 @@
|
||||
*/
|
||||
package com.siyeh.ig.bugs;
|
||||
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.PsiBinaryExpression;
|
||||
import com.intellij.psi.PsiExpression;
|
||||
import com.intellij.psi.PsiJavaToken;
|
||||
import com.intellij.psi.PsiKeyword;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
import com.siyeh.ig.BaseInspection;
|
||||
import com.siyeh.ig.BaseInspectionVisitor;
|
||||
@@ -27,24 +30,29 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class StringEqualityInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message("string.comparison.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message("string.comparison.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabledByDefault() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new ObjectEqualityVisitor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public InspectionGadgetsFix buildFix(Object... infos) {
|
||||
return new EqualityToEqualsFix();
|
||||
}
|
||||
|
||||
+7
-1
@@ -15,7 +15,10 @@
|
||||
*/
|
||||
package com.siyeh.ig.bugs;
|
||||
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.JavaTokenType;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiMethod;
|
||||
import com.intellij.psi.PsiPolyadicExpression;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
@@ -26,18 +29,21 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class SubtractionInCompareToInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"subtraction.in.compareto.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"subtraction.in.compareto.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new SubtractionInCompareToVisitor();
|
||||
}
|
||||
|
||||
+3
@@ -23,18 +23,21 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class TextLabelInSwitchStatementInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"text.label.in.switch.statement.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"text.label.in.switch.statement.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new TextLabelInSwitchStatementVisitor();
|
||||
}
|
||||
|
||||
+5
@@ -27,26 +27,31 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class AnonymousInnerClassInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"anonymous.inner.class.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"anonymous.inner.class.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InspectionGadgetsFix buildFix(Object... infos) {
|
||||
return new MoveAnonymousToInnerClassFix();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean buildQuickFixesOnlyForOnTheFlyErrors() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new AnonymousInnerClassVisitor();
|
||||
}
|
||||
|
||||
+7
-1
@@ -15,10 +15,10 @@
|
||||
*/
|
||||
package com.siyeh.ig.classlayout;
|
||||
|
||||
import com.intellij.psi.JspPsiUtil;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiJavaFile;
|
||||
import com.intellij.psi.JspPsiUtil;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
import com.siyeh.ig.BaseInspection;
|
||||
import com.siyeh.ig.BaseInspectionVisitor;
|
||||
@@ -29,31 +29,37 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ClassInTopLevelPackageInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getID() {
|
||||
return "ClassWithoutPackageStatement";
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"class.in.top.level.package.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"class.in.top.level.package.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InspectionGadgetsFix buildFix(Object... infos) {
|
||||
return new MoveClassFix();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean buildQuickFixesOnlyForOnTheFlyErrors() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new ClassInTopLevelPackageVisitor();
|
||||
}
|
||||
|
||||
@@ -27,17 +27,20 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class ClassInitializerInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getID() {
|
||||
return "NonStaticInitializer";
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"class.initializer.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
@@ -50,6 +53,7 @@ public class ClassInitializerInspection extends BaseInspection {
|
||||
return new ChangeModifierFix(PsiModifier.STATIC);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new ClassInitializerVisitor();
|
||||
}
|
||||
|
||||
+6
@@ -31,30 +31,35 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class ClassMayBeInterfaceInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"class.may.be.interface.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"class.may.be.interface.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InspectionGadgetsFix buildFix(Object... infos) {
|
||||
return new ClassMayBeInterfaceFix();
|
||||
}
|
||||
|
||||
private static class ClassMayBeInterfaceFix extends InspectionGadgetsFix {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"class.may.be.interface.convert.quickfix");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFix(Project project, ProblemDescriptor descriptor)
|
||||
throws IncorrectOperationException {
|
||||
final PsiIdentifier classNameIdentifier =
|
||||
@@ -149,6 +154,7 @@ public class ClassMayBeInterfaceInspection extends BaseInspection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new ClassMayBeInterfaceVisitor();
|
||||
}
|
||||
|
||||
+5
-1
@@ -15,10 +15,10 @@
|
||||
*/
|
||||
package com.siyeh.ig.classlayout;
|
||||
|
||||
import com.intellij.psi.JspPsiUtil;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiJavaFile;
|
||||
import com.intellij.psi.JspPsiUtil;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
import com.siyeh.ig.BaseInspection;
|
||||
import com.siyeh.ig.BaseInspectionVisitor;
|
||||
@@ -29,18 +29,21 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class ClassNameDiffersFromFileNameInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"class.name.differs.from.file.name.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"class.name.differs.from.file.name.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected InspectionGadgetsFix buildFix(Object... infos) {
|
||||
final PsiJavaFile file = (PsiJavaFile)infos[0];
|
||||
@@ -57,6 +60,7 @@ public class ClassNameDiffersFromFileNameInspection extends BaseInspection {
|
||||
return new RenameFix(filenameWithoutPrefix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new ClassNameDiffersFromFileNameVisitor();
|
||||
}
|
||||
|
||||
+3
@@ -25,18 +25,21 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ConstantDeclaredInAbstractClassInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"constant.declared.in.abstract.class.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"constant.declared.in.abstract.class.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new ConstantDeclaredInAbstractClassVisitor();
|
||||
}
|
||||
|
||||
+3
@@ -24,18 +24,21 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ConstantDeclaredInInterfaceInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"constant.declared.in.interface.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"constant.declared.in.interface.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new ConstantDeclaredInInterfaceVisitor();
|
||||
}
|
||||
|
||||
+1
@@ -39,6 +39,7 @@ public class FieldCanBeMovedToSubclassInspection extends BaseGlobalInspection {
|
||||
//return InspectionGadgetsBundle.message("field.can.be.moved.so.subclass.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public CommonProblemDescriptor[] checkElement(
|
||||
RefEntity refEntity, AnalysisScope analysisScope,
|
||||
|
||||
@@ -26,21 +26,25 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class FinalMethodInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message("final.method.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"final.method.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new FinalMethodVisitor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public InspectionGadgetsFix buildFix(Object... infos) {
|
||||
return new RemoveModifierFix((String)infos[0]);
|
||||
}
|
||||
|
||||
+5
@@ -26,26 +26,31 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class FinalStaticMethodInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"final.static.method.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"final.static.method.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabledByDefault() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new FinalStaticMethodVisitor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public InspectionGadgetsFix buildFix(Object... infos) {
|
||||
return new RemoveModifierFix((String)infos[0]);
|
||||
}
|
||||
|
||||
+8
-1
@@ -15,10 +15,10 @@
|
||||
*/
|
||||
package com.siyeh.ig.classlayout;
|
||||
|
||||
import com.intellij.codeInspection.ui.SingleCheckboxOptionsPanel;
|
||||
import com.intellij.psi.PsiAnonymousClass;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiTypeParameter;
|
||||
import com.intellij.codeInspection.ui.SingleCheckboxOptionsPanel;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
import com.siyeh.ig.BaseInspection;
|
||||
import com.siyeh.ig.BaseInspectionVisitor;
|
||||
@@ -35,23 +35,27 @@ public class InnerClassOnInterfaceInspection extends BaseInspection {
|
||||
*/
|
||||
public boolean m_ignoreInnerInterfaces = false;
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getID() {
|
||||
return "InnerClassOfInterface";
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"inner.class.on.interface.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public JComponent createOptionsPanel() {
|
||||
return new SingleCheckboxOptionsPanel(InspectionGadgetsBundle.message(
|
||||
"inner.class.on.interface.ignore.option"),
|
||||
this, "m_ignoreInnerInterfaces");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
final PsiClass parentInterface = (PsiClass)infos[0];
|
||||
@@ -60,14 +64,17 @@ public class InnerClassOnInterfaceInspection extends BaseInspection {
|
||||
"inner.class.on.interface.problem.descriptor", interfaceName);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InspectionGadgetsFix buildFix(Object... infos) {
|
||||
return new MoveClassFix();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean buildQuickFixesOnlyForOnTheFlyErrors() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new InnerClassOnInterfaceVisitor();
|
||||
}
|
||||
|
||||
+5
@@ -26,26 +26,31 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class LimitedScopeInnerClassInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"limited.scope.inner.class.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"limited.scope.inner.class.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InspectionGadgetsFix buildFix(Object... infos) {
|
||||
return new MoveClassFix();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean buildQuickFixesOnlyForOnTheFlyErrors() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new LimitedScopeInnerClassVisitor();
|
||||
}
|
||||
|
||||
+2
-1
@@ -29,7 +29,7 @@ import com.siyeh.ig.InspectionGadgetsFix;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.*;
|
||||
|
||||
public class ListenerMayUseAdapterInspection extends BaseInspection {
|
||||
|
||||
@@ -76,6 +76,7 @@ public class ListenerMayUseAdapterInspection extends BaseInspection {
|
||||
this.adapterClass = adapterClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
|
||||
+1
@@ -43,6 +43,7 @@ public class MethodReturnAlwaysConstantInspection extends BaseGlobalInspection {
|
||||
"method.return.always.constant.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonProblemDescriptor[] checkElement(
|
||||
RefEntity refEntity, AnalysisScope scope, InspectionManager manager,
|
||||
GlobalInspectionContext globalContext) {
|
||||
|
||||
+1
@@ -53,6 +53,7 @@ public class MissingDeprecatedAnnotationInspection extends BaseInspection {
|
||||
|
||||
private static class MissingDeprecatedAnnotationFix extends InspectionGadgetsFix {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message("missing.deprecated.annotation.add.quickfix");
|
||||
|
||||
+1
@@ -83,6 +83,7 @@ public class MissingOverrideAnnotationInspection extends BaseInspection {
|
||||
private static class MissingOverrideAnnotationFix
|
||||
extends InspectionGadgetsFix {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
|
||||
+5
@@ -27,26 +27,31 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class MultipleTopLevelClassesInFileInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"multiple.top.level.classes.in.file.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"multiple.top.level.classes.in.file.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InspectionGadgetsFix buildFix(Object... infos) {
|
||||
return new MoveClassFix();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean buildQuickFixesOnlyForOnTheFlyErrors() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new MultipleTopLevelClassesInFileVisitor();
|
||||
}
|
||||
|
||||
+1
@@ -46,6 +46,7 @@ public class NonFinalFieldInEnumInspection extends BaseInspection {
|
||||
return InspectionGadgetsBundle.message("non.final.field.in.enum.problem.descriptor", enumClass.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected InspectionGadgetsFix buildFix(Object... infos) {
|
||||
final PsiField field = (PsiField)infos[1];
|
||||
|
||||
+3
@@ -26,16 +26,19 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class NoopMethodInAbstractClassInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message("noop.method.in.abstract.class.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message("noop.method.in.abstract.class.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new NoopMethodInAbstractClassVisitor();
|
||||
}
|
||||
|
||||
+1
@@ -71,6 +71,7 @@ public class ProtectedMemberInFinalClassInspection extends BaseInspection {
|
||||
|
||||
private static class MakePrivateFix extends InspectionGadgetsFix {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message("make.private.quickfix");
|
||||
|
||||
+6
@@ -32,11 +32,13 @@ import java.util.List;
|
||||
|
||||
public class PublicConstructorInNonPublicClassInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message("public.constructor.in.non.public.class.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
final PsiMethod method = (PsiMethod)infos[0];
|
||||
@@ -44,10 +46,12 @@ public class PublicConstructorInNonPublicClassInspection extends BaseInspection
|
||||
method.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new PublicConstructorInNonPublicClassVisitor();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public InspectionGadgetsFix[] buildFixes(Object... infos) {
|
||||
final List<InspectionGadgetsFix> fixes = new ArrayList();
|
||||
@@ -68,6 +72,7 @@ public class PublicConstructorInNonPublicClassInspection extends BaseInspection
|
||||
this.modifier = modifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
@@ -76,6 +81,7 @@ public class PublicConstructorInNonPublicClassInspection extends BaseInspection
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doFix(Project project, ProblemDescriptor descriptor) throws IncorrectOperationException {
|
||||
final PsiElement element = descriptor.getPsiElement();
|
||||
final PsiModifierList modifierList = (PsiModifierList)element.getParent();
|
||||
|
||||
+1
@@ -40,6 +40,7 @@ public class StaticFieldCanBeMovedToUseInspection extends BaseGlobalInspection {
|
||||
// "static.field.can.be.moved.to.use.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public CommonProblemDescriptor[] checkElement(
|
||||
RefEntity refEntity, AnalysisScope analysisScope,
|
||||
|
||||
+4
@@ -27,24 +27,28 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class StaticNonFinalFieldInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"static.non.final.field.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"static.non.final.field.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected InspectionGadgetsFix buildFix(Object... infos) {
|
||||
final PsiField field = (PsiField)infos[0];
|
||||
return MakeFieldFinalFix.buildFix(field);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new StaticNonFinalFieldVisitor();
|
||||
}
|
||||
|
||||
+1
@@ -65,6 +65,7 @@ public class UtilityClassWithPublicConstructorInspection
|
||||
m_multipleConstructors = multipleConstructors;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
|
||||
+3
@@ -100,6 +100,7 @@ public class UtilityClassWithoutPrivateConstructorInspection extends BaseInspect
|
||||
|
||||
private static class CreateEmptyPrivateConstructor extends InspectionGadgetsFix {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message("utility.class.without.private.constructor.create.quickfix");
|
||||
@@ -122,6 +123,7 @@ public class UtilityClassWithoutPrivateConstructorInspection extends BaseInspect
|
||||
final PsiElement context = element.getParent();
|
||||
if (context instanceof PsiNewExpression) {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Messages.showInfoMessage(aClass.getProject(),
|
||||
"Utility class has instantiations, private constructor will not be created",
|
||||
@@ -144,6 +146,7 @@ public class UtilityClassWithoutPrivateConstructorInspection extends BaseInspect
|
||||
|
||||
private static class MakeConstructorPrivateFix extends InspectionGadgetsFix {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message("utility.class.without.private.constructor.make.quickfix");
|
||||
|
||||
@@ -27,26 +27,31 @@ public class ClassComplexityInspection
|
||||
|
||||
private static final int DEFAULT_COMPLEXITY_LIMIT = 80;
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getID() {
|
||||
return "OverlyComplexClass";
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"overly.complex.class.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getDefaultLimit() {
|
||||
return DEFAULT_COMPLEXITY_LIMIT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getConfigurationLabel() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"cyclomatic.complexity.limit.option");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
final Integer totalComplexity = (Integer)infos[0];
|
||||
@@ -54,6 +59,7 @@ public class ClassComplexityInspection
|
||||
"overly.complex.class.problem.descriptor", totalComplexity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new ClassComplexityVisitor();
|
||||
}
|
||||
|
||||
+6
@@ -28,6 +28,7 @@ import java.util.Set;
|
||||
public class ClassInheritanceDepthInspection
|
||||
extends ClassMetricInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getID() {
|
||||
return "ClassTooDeepInInheritanceTree";
|
||||
@@ -35,20 +36,24 @@ public class ClassInheritanceDepthInspection
|
||||
|
||||
private static final int CLASS_INHERITANCE_LIMIT = 2;
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message("class.too.deep.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getDefaultLimit() {
|
||||
return CLASS_INHERITANCE_LIMIT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getConfigurationLabel() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"class.too.deep.inheritance.depth.limit.option");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
final Integer count = (Integer)infos[0];
|
||||
@@ -56,6 +61,7 @@ public class ClassInheritanceDepthInspection
|
||||
"class.too.deep.problem.descriptor", count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new ClassNestingLevel();
|
||||
}
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
*/
|
||||
package com.siyeh.ig.classmetrics;
|
||||
|
||||
import com.siyeh.ig.BaseInspection;
|
||||
import com.intellij.codeInspection.ui.SingleIntegerFieldOptionsPanel;
|
||||
import com.siyeh.ig.BaseInspection;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.*;
|
||||
|
||||
public abstract class ClassMetricInspection extends BaseInspection {
|
||||
|
||||
@@ -35,6 +35,7 @@ public abstract class ClassMetricInspection extends BaseInspection {
|
||||
return m_limit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JComponent createOptionsPanel() {
|
||||
final String label = getConfigurationLabel();
|
||||
return new SingleIntegerFieldOptionsPanel(label,
|
||||
|
||||
+6
@@ -27,26 +27,31 @@ public class ClassNestingDepthInspection
|
||||
|
||||
private static final int CLASS_NESTING_LIMIT = 1;
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getID() {
|
||||
return "InnerClassTooDeeplyNested";
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"inner.class.too.deeply.nested.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getDefaultLimit() {
|
||||
return CLASS_NESTING_LIMIT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getConfigurationLabel() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"inner.class.too.deeply.nested.nesting.limit.option");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
final Integer nestingLevel = (Integer)infos[0];
|
||||
@@ -55,6 +60,7 @@ public class ClassNestingDepthInspection
|
||||
nestingLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new ClassNestingLevel();
|
||||
}
|
||||
|
||||
+6
@@ -33,20 +33,24 @@ public class ConstructorCountInspection extends ClassMetricInspection {
|
||||
|
||||
public boolean ignoreDeprecatedConstructors = false;
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getID() {
|
||||
return "ClassWithTooManyConstructors";
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message("too.many.constructors.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getDefaultLimit() {
|
||||
return CONSTRUCTOR_COUNT_LIMIT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getConfigurationLabel() {
|
||||
return InspectionGadgetsBundle.message("too.many.constructors.count.limit.option");
|
||||
}
|
||||
@@ -68,12 +72,14 @@ public class ConstructorCountInspection extends ClassMetricInspection {
|
||||
return panel;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
final Integer count = (Integer)infos[0];
|
||||
return InspectionGadgetsBundle.message("too.many.constructors.problem.descriptor", count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new ConstructorCountVisitor();
|
||||
}
|
||||
|
||||
+3
@@ -25,18 +25,21 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class CloneCallsConstructorsInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"clone.instantiates.objects.with.constructor.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"clone.instantiates.objects.with.constructor.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new CloneCallsConstructorVisitor();
|
||||
}
|
||||
|
||||
+5
@@ -26,27 +26,32 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class CloneCallsSuperCloneInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getID() {
|
||||
return "CloneDoesntCallSuperClone";
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"clone.doesnt.call.super.clone.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"clone.doesnt.call.super.clone.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabledByDefault() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new NoExplicitCloneCallsVisitor();
|
||||
}
|
||||
|
||||
@@ -24,17 +24,20 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class BreakStatementInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message("break.statement.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"statement.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new BreakStatementVisitor();
|
||||
}
|
||||
|
||||
+3
@@ -24,18 +24,21 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class BreakStatementWithLabelInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"break.statement.with.label.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"break.statement.with.label.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new BreakStatementWithLabelVisitor();
|
||||
}
|
||||
|
||||
+6
@@ -30,30 +30,35 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class ConditionalExpressionWithIdenticalBranchesInspection
|
||||
extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"conditional.expression.with.identical.branches.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"conditional.expression.with.identical.branches.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public InspectionGadgetsFix buildFix(Object... infos) {
|
||||
return new CollapseConditional();
|
||||
}
|
||||
|
||||
private static class CollapseConditional extends InspectionGadgetsFix {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"conditional.expression.with.identical.branches.collapse.quickfix");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFix(Project project, ProblemDescriptor descriptor)
|
||||
throws IncorrectOperationException {
|
||||
final PsiConditionalExpression expression =
|
||||
@@ -66,6 +71,7 @@ public class ConditionalExpressionWithIdenticalBranchesInspection
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new ConditionalExpressionWithIdenticalBranchesVisitor();
|
||||
}
|
||||
|
||||
@@ -72,6 +72,7 @@ public class ConfusingElseInspection extends BaseInspection {
|
||||
|
||||
private static class ConfusingElseFix extends InspectionGadgetsFix {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message("confusing.else.unwrap.quickfix");
|
||||
|
||||
+1
@@ -74,6 +74,7 @@ public class ConstantConditionalExpressionInspection
|
||||
|
||||
private static class ConstantConditionalFix extends InspectionGadgetsFix {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
|
||||
+2
@@ -65,12 +65,14 @@ public class ConstantIfStatementInspection extends BaseInspection {
|
||||
|
||||
private static class ConstantIfStatementFix extends InspectionGadgetsFix {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"constant.conditional.expression.simplify.quickfix");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFix(Project project, ProblemDescriptor descriptor)
|
||||
throws IncorrectOperationException {
|
||||
final PsiElement ifKeyword = descriptor.getPsiElement();
|
||||
|
||||
+3
@@ -23,18 +23,21 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ContinueStatementInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"continue.statement.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"statement.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new ContinueStatementVisitor();
|
||||
}
|
||||
|
||||
+3
@@ -24,18 +24,21 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ContinueStatementWithLabelInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"continue.statement.with.label.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"continue.statement.with.label.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new ContinueStatementWithLabelVisitor();
|
||||
}
|
||||
|
||||
+3
@@ -26,18 +26,21 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class DefaultNotLastCaseInSwitchInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"default.not.last.case.in.switch.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"default.not.last.case.in.switch.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new DefaultNotLastCaseInSwitchVisitor();
|
||||
}
|
||||
|
||||
@@ -30,11 +30,13 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class DoubleNegationInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message("double.negation.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message("double.negation.problem.descriptor");
|
||||
@@ -45,6 +47,7 @@ public class DoubleNegationInspection extends BaseInspection {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected InspectionGadgetsFix buildFix(Object... infos) {
|
||||
return new DoubleNegationFix();
|
||||
@@ -52,11 +55,13 @@ public class DoubleNegationInspection extends BaseInspection {
|
||||
|
||||
private static class DoubleNegationFix extends InspectionGadgetsFix {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message("double.negation.quickfix");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doFix(Project project, ProblemDescriptor descriptor) throws IncorrectOperationException {
|
||||
final PsiElement expression = descriptor.getPsiElement();
|
||||
if (expression instanceof PsiPrefixExpression) {
|
||||
@@ -96,6 +101,7 @@ public class DoubleNegationInspection extends BaseInspection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new DoubleNegationVisitor();
|
||||
}
|
||||
|
||||
+3
@@ -29,16 +29,19 @@ import java.util.Set;
|
||||
|
||||
public class DuplicateBooleanBranchInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message("duplicate.boolean.branch.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message("duplicate.boolean.branch.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new DuplicateBooleanBranchVisitor();
|
||||
}
|
||||
|
||||
+4
@@ -40,22 +40,26 @@ public class DuplicateConditionInspection extends BaseInspection {
|
||||
// This is a dirty fix of 'squared' algorithm performance issue.
|
||||
private static final int LIMIT_DEPTH = 20;
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message("duplicate.condition.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message("duplicate.condition.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public JComponent createOptionsPanel() {
|
||||
return new SingleCheckboxOptionsPanel(InspectionGadgetsBundle.message("duplicate.condition.ignore.method.calls.option"),
|
||||
this, "ignoreMethodCalls");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new DuplicateConditionVisitor();
|
||||
}
|
||||
|
||||
+7
-3
@@ -16,11 +16,9 @@
|
||||
package com.siyeh.ig.controlflow;
|
||||
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.codeInspection.ui.SingleCheckboxOptionsPanel;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
import com.siyeh.ig.BaseInspection;
|
||||
import com.siyeh.ig.BaseInspectionVisitor;
|
||||
@@ -29,42 +27,48 @@ import com.siyeh.ig.psiutils.ControlFlowUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class FallthruInSwitchStatementInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message("fallthru.in.switch.statement.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getID() {
|
||||
return "fallthrough";
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message("fallthru.in.switch.statement.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected InspectionGadgetsFix buildFix(Object... infos) {
|
||||
return new FallthruInSwitchStatementFix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new FallthroughInSwitchStatementVisitor();
|
||||
}
|
||||
|
||||
private static class FallthruInSwitchStatementFix extends InspectionGadgetsFix {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message("fallthru.in.switch.statement.quickfix");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doFix(Project project, ProblemDescriptor descriptor) {
|
||||
final PsiSwitchLabelStatement labelStatement = (PsiSwitchLabelStatement)descriptor.getPsiElement();
|
||||
final JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(project);
|
||||
|
||||
+1
@@ -70,6 +70,7 @@ public class ForLoopReplaceableByWhileInspection extends BaseInspection {
|
||||
|
||||
private static class ReplaceForByWhileFix extends InspectionGadgetsFix {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
|
||||
+1
@@ -67,6 +67,7 @@ public class IfMayBeConditionalInspection extends BaseInspection {
|
||||
|
||||
private static class IfMayBeConditionalFix extends InspectionGadgetsFix {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
|
||||
+1
@@ -62,6 +62,7 @@ public class IfStatementWithIdenticalBranchesInspection
|
||||
public CollapseIfFix() {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
|
||||
+5
-1
@@ -15,10 +15,10 @@
|
||||
*/
|
||||
package com.siyeh.ig.controlflow;
|
||||
|
||||
import com.intellij.codeInspection.ui.SingleIntegerFieldOptionsPanel;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiIfStatement;
|
||||
import com.intellij.psi.PsiStatement;
|
||||
import com.intellij.codeInspection.ui.SingleIntegerFieldOptionsPanel;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
import com.siyeh.ig.BaseInspection;
|
||||
import com.siyeh.ig.BaseInspectionVisitor;
|
||||
@@ -38,12 +38,14 @@ public class IfStatementWithTooManyBranchesInspection
|
||||
*/
|
||||
public int m_limit = DEFAULT_BRANCH_LIMIT;
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"if.statement.with.too.many.branches.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public JComponent createOptionsPanel() {
|
||||
return new SingleIntegerFieldOptionsPanel(
|
||||
InspectionGadgetsBundle.message(
|
||||
@@ -51,6 +53,7 @@ public class IfStatementWithTooManyBranchesInspection
|
||||
this, "m_limit");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected String buildErrorString(Object... infos) {
|
||||
final Integer branchCount = (Integer)infos[0];
|
||||
@@ -59,6 +62,7 @@ public class IfStatementWithTooManyBranchesInspection
|
||||
branchCount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new IfStatementWithTooManyBranchesVisitor();
|
||||
}
|
||||
|
||||
@@ -24,18 +24,21 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class LabeledStatementInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"labeled.statement.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"labeled.statement.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new LabeledStatementVisitor();
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user