mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java] get rid of ProblemHighlightType.LIKE_UNUSED_SYMBOL in favor of editor attributes (IDEA-27007)
GitOrigin-RevId: 950de9dbd0cf727c6baa7363783e1723fb398a62
This commit is contained in:
committed by
intellij-monorepo-bot
parent
1c4fb5cd4a
commit
e9b02eb233
@@ -98,6 +98,7 @@
|
||||
<localInspection groupPathKey="group.path.names.java.language.level.specific.issues.and.migration.aids" language="JAVA" shortName="AnonymousHasLambdaAlternative"
|
||||
groupKey="group.names.language.level.specific.issues.and.migration.aids8" groupBundle="messages.InspectionsBundle" enabledByDefault="true" level="WARNING"
|
||||
implementationClass="com.intellij.codeInspection.AnonymousHasLambdaAlternativeInspection"
|
||||
editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
key="inspection.anonymous.has.lambda.alternative.display.name" bundle="messages.JavaAnalysisBundle"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="StringTokenizerDelimiter"
|
||||
groupBundle="messages.InspectionsBundle"
|
||||
@@ -126,6 +127,7 @@
|
||||
<localInspection groupPathKey="group.path.names.java.language.level.specific.issues.and.migration.aids" language="JAVA" shortName="CodeBlock2Expr"
|
||||
groupKey="group.names.language.level.specific.issues.and.migration.aids8" groupBundle="messages.InspectionsBundle" enabledByDefault="true" level="WARNING"
|
||||
implementationClass="com.intellij.codeInspection.RedundantLambdaCodeBlockInspection"
|
||||
editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
key="statement.lambda.can.be.replaced.with.expression.lambda" bundle="messages.JavaAnalysisBundle"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="InvalidComparatorMethodReference"
|
||||
groupKey="group.names.probable.bugs" groupBundle="messages.InspectionsBundle" enabledByDefault="true" level="WARNING"
|
||||
@@ -139,6 +141,7 @@
|
||||
<localInspection groupPathKey="group.path.names.java.language.level.specific.issues.and.migration.aids" language="JAVA" shortName="Convert2Diamond"
|
||||
groupKey="group.names.language.level.specific.issues.and.migration.aids7" groupBundle="messages.InspectionsBundle" enabledByDefault="true" level="WARNING"
|
||||
implementationClass="com.intellij.codeInspection.ExplicitTypeCanBeDiamondInspection"
|
||||
editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
key="inspection.convert.2.diamond.display.name" bundle="messages.JavaAnalysisBundle"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="UseCompareMethod"
|
||||
groupKey="group.names.language.level.specific.issues.and.migration.aids" groupBundle="messages.InspectionsBundle" enabledByDefault="true" level="WARNING"
|
||||
@@ -170,6 +173,7 @@
|
||||
key="inspection.field.access.not.guarded.display.name" bundle="messages.JavaAnalysisBundle"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="DuplicateThrows" bundle="messages.JavaAnalysisBundle" key="inspection.duplicate.throws.display.name"
|
||||
groupBundle="messages.InspectionsBundle" groupKey="group.names.declaration.redundancy" enabledByDefault="true" level="WARNING" cleanupTool="true"
|
||||
editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.intellij.codeInspection.duplicateThrows.DuplicateThrowsInspection" />
|
||||
<globalInspection groupPath="Java" shortName="UnnecessaryModuleDependencyInspection" bundle="messages.JavaAnalysisBundle"
|
||||
key="unnecessary.module.dependency.display.name" groupBundle="messages.InspectionsBundle" groupKey="group.names.declaration.redundancy" enabledByDefault="true"
|
||||
@@ -211,10 +215,12 @@
|
||||
implementationClass="com.intellij.codeInspection.miscGenerics.SuspiciousCollectionsMethodCallsInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="RedundantTypeArguments" bundle="messages.JavaAnalysisBundle" key="inspection.redundant.type.display.name"
|
||||
groupBundle="messages.InspectionsBundle" groupKey="group.names.verbose.or.redundant.code.constructs" enabledByDefault="true" level="WARNING" cleanupTool="true"
|
||||
editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.intellij.codeInspection.miscGenerics.RedundantTypeArgsInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="RedundantCast" groupKey="group.names.verbose.or.redundant.code.constructs" groupBundle="messages.InspectionsBundle"
|
||||
enabledByDefault="true" level="WARNING" cleanupTool="true"
|
||||
implementationClass="com.intellij.codeInspection.redundantCast.RedundantCastInspection"
|
||||
editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
key="inspection.redundant.cast.display.name" bundle="messages.JavaAnalysisBundle"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="NumericOverflow" groupKey="group.names.numeric.issues" groupBundle="messages.InspectionsBundle" enabledByDefault="true"
|
||||
level="WARNING" implementationClass="com.intellij.codeInspection.NumericOverflowInspection"
|
||||
@@ -224,7 +230,7 @@
|
||||
implementationClass="com.intellij.codeInspection.dataFlow.ContractInspection"/>
|
||||
<globalInspection groupPath="Java" language="JAVA" shortName="Java9RedundantRequiresStatement"
|
||||
groupBundle="messages.InspectionsBundle" groupKey="group.names.declaration.redundancy"
|
||||
enabledByDefault="true" level="WARNING"
|
||||
enabledByDefault="true" level="WARNING" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.intellij.codeInspection.java19modules.Java9RedundantRequiresStatementInspection"
|
||||
key="inspection.java.9.redundant.requires.statement.display.name" bundle="messages.JavaAnalysisBundle"/>
|
||||
<globalInspection groupPath="Java" language="JAVA" shortName="UNUSED_IMPORT" bundle="messages.JavaAnalysisBundle" key="unused.import.display.name"
|
||||
@@ -233,6 +239,7 @@
|
||||
<globalInspection groupPath="Java" language="JAVA" shortName="RedundantThrows" groupKey="group.names.declaration.redundancy" groupBundle="messages.InspectionsBundle"
|
||||
enabledByDefault="true" level="WARNING"
|
||||
implementationClass="com.intellij.codeInspection.unneededThrows.RedundantThrowsDeclarationInspection"
|
||||
editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
key="inspection.redundant.throws.display.name" bundle="messages.JavaAnalysisBundle"/>
|
||||
<globalInspection groupPath="Java" language="JAVA" shortName="SameReturnValue" bundle="messages.JavaAnalysisBundle" key="inspection.same.return.value.display.name"
|
||||
groupBundle="messages.InspectionsBundle" groupKey="group.names.declaration.redundancy" enabledByDefault="true" level="WARNING"
|
||||
|
||||
+3
-4
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInspection;
|
||||
|
||||
import com.intellij.java.analysis.JavaAnalysisBundle;
|
||||
@@ -63,9 +63,8 @@ public class AnonymousHasLambdaAlternativeInspection extends AbstractBaseJavaLoc
|
||||
final PsiElement lBrace = aClass.getLBrace();
|
||||
LOG.assertTrue(lBrace != null);
|
||||
final TextRange rangeInElement = new TextRange(0, lBrace.getStartOffsetInParent() + aClass.getStartOffsetInParent() - 1);
|
||||
holder.registerProblem(aClass.getParent(),
|
||||
JavaAnalysisBundle.message("anonymous.ref.loc.can.be.replaced.with.0", alternative.myReplacementMessage),
|
||||
ProblemHighlightType.LIKE_UNUSED_SYMBOL, rangeInElement, new ReplaceWithLambdaAlternativeFix(alternative));
|
||||
holder.registerProblem(aClass.getParent(), rangeInElement,
|
||||
JavaAnalysisBundle.message("anonymous.ref.loc.can.be.replaced.with.0", alternative.myReplacementMessage), new ReplaceWithLambdaAlternativeFix(alternative));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInspection;
|
||||
|
||||
import com.intellij.codeInsight.intention.HighPriorityAction;
|
||||
@@ -54,7 +54,7 @@ public class ExplicitTypeCanBeDiamondInspection extends AbstractBaseJavaLocalIns
|
||||
final PsiElement lastChild = parameterList.getLastChild();
|
||||
final TextRange range = new TextRange(firstChild != null && firstChild.getNode().getElementType() == JavaTokenType.LT ? 1 : 0,
|
||||
parameterList.getTextLength() - (lastChild != null && lastChild.getNode().getElementType() == JavaTokenType.GT ? 1 : 0));
|
||||
holder.registerProblem(parameterList, JavaAnalysisBundle.message("explicit.type.argument.ref.loc.can.be.replaced.with"), ProblemHighlightType.LIKE_UNUSED_SYMBOL, range, new ReplaceWithDiamondFix());
|
||||
holder.registerProblem(parameterList, range, JavaAnalysisBundle.message("explicit.type.argument.ref.loc.can.be.replaced.with"), new ReplaceWithDiamondFix());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
+2
-3
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInspection;
|
||||
|
||||
import com.intellij.codeInsight.intention.HighPriorityAction;
|
||||
@@ -55,8 +55,7 @@ public class RedundantLambdaCodeBlockInspection extends AbstractBaseJavaLocalIns
|
||||
} else {
|
||||
errorElement = body.getFirstChild();
|
||||
}
|
||||
holder.registerProblem(errorElement, JavaAnalysisBundle.message("statement.lambda.can.be.replaced.with.expression.lambda"),
|
||||
ProblemHighlightType.LIKE_UNUSED_SYMBOL, new ReplaceWithExprFix());
|
||||
holder.registerProblem(errorElement, JavaAnalysisBundle.message("statement.lambda.can.be.replaced.with.expression.lambda"), new ReplaceWithExprFix());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
+6
-3
@@ -1,8 +1,11 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInspection.duplicateThrows;
|
||||
|
||||
import com.intellij.codeInsight.daemon.impl.quickfix.MethodThrowsFix;
|
||||
import com.intellij.codeInspection.*;
|
||||
import com.intellij.codeInspection.AbstractBaseJavaLocalInspectionTool;
|
||||
import com.intellij.codeInspection.CleanupLocalInspectionTool;
|
||||
import com.intellij.codeInspection.InspectionsBundle;
|
||||
import com.intellij.codeInspection.ProblemsHolder;
|
||||
import com.intellij.codeInspection.ui.SingleCheckboxOptionsPanel;
|
||||
import com.intellij.java.analysis.JavaAnalysisBundle;
|
||||
import com.intellij.psi.*;
|
||||
@@ -77,7 +80,7 @@ public class DuplicateThrowsInspection extends AbstractBaseJavaLocalInspectionTo
|
||||
}
|
||||
}
|
||||
if (problem != null) {
|
||||
holder.registerProblem(ref, problem, ProblemHighlightType.LIKE_UNUSED_SYMBOL, new MethodThrowsFix.RemoveFirst(method, type, false));
|
||||
holder.registerProblem(ref, problem, new MethodThrowsFix.RemoveFirst(method, type, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -75,7 +75,7 @@ public final class Java9RedundantRequiresStatementInspection extends GlobalJavaB
|
||||
requiresStatement,
|
||||
message,
|
||||
requiresStatementFix,
|
||||
ProblemHighlightType.LIKE_UNUSED_SYMBOL, false);
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING, false);
|
||||
descriptors.add(descriptor);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -100,7 +100,7 @@ public class RedundantTypeArgsInspection extends GenericsInspectionToolBase {
|
||||
inspectionManager.createProblemDescriptor(expression.getTypeArgumentList(),
|
||||
JavaAnalysisBundle.message(key),
|
||||
ourQuickFixAction,
|
||||
ProblemHighlightType.LIKE_UNUSED_SYMBOL, isOnTheFly);
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING, isOnTheFly);
|
||||
problems.add(descriptor);
|
||||
}
|
||||
}
|
||||
@@ -126,7 +126,7 @@ public class RedundantTypeArgsInspection extends GenericsInspectionToolBase {
|
||||
final PsiReferenceParameterList parameterList = referenceElement.getParameterList();
|
||||
LOG.assertTrue(parameterList != null);
|
||||
final ProblemDescriptor descriptor = inspectionManager.createProblemDescriptor(parameterList, JavaAnalysisBundle
|
||||
.message("inspection.redundant.type.problem.descriptor"), ourQuickFixAction, ProblemHighlightType.LIKE_UNUSED_SYMBOL, isOnTheFly);
|
||||
.message("inspection.redundant.type.problem.descriptor"), ourQuickFixAction, ProblemHighlightType.GENERIC_ERROR_OR_WARNING, isOnTheFly);
|
||||
problems.add(descriptor);
|
||||
}
|
||||
}
|
||||
@@ -147,7 +147,7 @@ public class RedundantTypeArgsInspection extends GenericsInspectionToolBase {
|
||||
final ProblemDescriptor descriptor =
|
||||
inspectionManager.createProblemDescriptor(parameterList,
|
||||
JavaAnalysisBundle.message(key),
|
||||
new MyQuickFixAction(), ProblemHighlightType.LIKE_UNUSED_SYMBOL, isOnTheFly);
|
||||
new MyQuickFixAction(), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, isOnTheFly);
|
||||
problems.add(descriptor);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -78,7 +78,7 @@ public class RedundantCastInspection extends AbstractBaseJavaLocalInspectionTool
|
||||
}
|
||||
|
||||
String message = JavaAnalysisBundle.message("inspection.redundant.cast.problem.descriptor", PsiExpressionTrimRenderer.render(operand));
|
||||
return manager.createProblemDescriptor(castType, message, myQuickFixAction, ProblemHighlightType.LIKE_UNUSED_SYMBOL, onTheFly);
|
||||
return manager.createProblemDescriptor(castType, message, myQuickFixAction, ProblemHighlightType.GENERIC_ERROR_OR_WARNING, onTheFly);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@ public final class RedundantThrowsDeclarationInspection extends GlobalJavaBatchI
|
||||
final PsiElement throwsRef = throwRefType.getReference();
|
||||
final String message = getMessage(refMethod);
|
||||
final MyQuickFix fix = new MyQuickFix(processor, throwRefType.getType().getClassName(), IGNORE_ENTRY_POINTS);
|
||||
return manager.createProblemDescriptor(throwsRef, message, fix, ProblemHighlightType.LIKE_UNUSED_SYMBOL, false);
|
||||
return manager.createProblemDescriptor(throwsRef, message, fix, ProblemHighlightType.GENERIC_ERROR_OR_WARNING, false);
|
||||
})
|
||||
.toArray(CommonProblemDescriptor.EMPTY_ARRAY);
|
||||
}
|
||||
|
||||
+1
-1
@@ -128,7 +128,7 @@ public final class RedundantThrowsDeclarationLocalInspection extends AbstractBas
|
||||
|
||||
final String description = JavaErrorBundle.message("exception.is.never.thrown", JavaHighlightUtil.formatType(exceptionType));
|
||||
final RedundantThrowsQuickFix fix = new RedundantThrowsQuickFix(exceptionType.getCanonicalText(), method.getName());
|
||||
myHolder.registerProblem(reference, description, ProblemHighlightType.LIKE_UNUSED_SYMBOL, fix);
|
||||
myHolder.registerProblem(reference, description, ProblemHighlightType.GENERIC_ERROR_OR_WARNING, fix);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -56,7 +56,7 @@ public class ComparatorCombinatorsInspection extends AbstractBaseJavaLocalInspec
|
||||
String qualifiedName = Objects.requireNonNull(StringUtil.substringBefore(replacementText, "("));
|
||||
@NonNls String methodName = "Comparator." + StringUtil.getShortName(qualifiedName);
|
||||
final String problemMessage = InspectionGadgetsBundle.message("inspection.comparator.combinators.description2", methodName);
|
||||
holder.registerProblem(lambda, problemMessage, ProblemHighlightType.LIKE_UNUSED_SYMBOL, new ReplaceWithComparatorFix(CommonQuickFixBundle.message("fix.replace.with.x", methodName)));
|
||||
holder.registerProblem(lambda, problemMessage, ProblemHighlightType.GENERIC_ERROR_OR_WARNING, new ReplaceWithComparatorFix(CommonQuickFixBundle.message("fix.replace.with.x", methodName)));
|
||||
return;
|
||||
}
|
||||
if (lambda.getBody() instanceof PsiCodeBlock) {
|
||||
@@ -67,7 +67,7 @@ public class ComparatorCombinatorsInspection extends AbstractBaseJavaLocalInspec
|
||||
if (chainCombinator == null) return;
|
||||
if (!LambdaUtil.isSafeLambdaReplacement(lambda, chainCombinator)) return;
|
||||
final String problemMessage = InspectionGadgetsBundle.message("inspection.comparator.combinators.description");
|
||||
holder.registerProblem(lambda, problemMessage, ProblemHighlightType.LIKE_UNUSED_SYMBOL, new ReplaceWithComparatorFix(InspectionGadgetsBundle.message("inspection.comparator.combinators.fix.chain")));
|
||||
holder.registerProblem(lambda, problemMessage, ProblemHighlightType.GENERIC_ERROR_OR_WARNING, new ReplaceWithComparatorFix(InspectionGadgetsBundle.message("inspection.comparator.combinators.fix.chain")));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInspection;
|
||||
|
||||
import com.intellij.codeInsight.AnnotationUtil;
|
||||
@@ -58,7 +58,7 @@ public class DefaultAnnotationParamInspection extends AbstractBaseJavaLocalInspe
|
||||
return;
|
||||
}
|
||||
}
|
||||
holder.registerProblem(value, JavaBundle.message("inspection.message.redundant.default.parameter.value.assignment"), ProblemHighlightType.LIKE_UNUSED_SYMBOL,
|
||||
holder.registerProblem(value, JavaBundle.message("inspection.message.redundant.default.parameter.value.assignment"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
|
||||
createRemoveParameterFix());
|
||||
}
|
||||
}
|
||||
|
||||
+2
-3
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInspection;
|
||||
|
||||
import com.intellij.java.JavaBundle;
|
||||
@@ -45,8 +45,7 @@ public class RedundantExplicitCloseInspection extends AbstractBaseJavaLocalInspe
|
||||
EquivalenceChecker.getCanonicalPsiEquivalence()
|
||||
.expressionsAreEquivalent(reference, ((PsiResourceExpression)element).getExpression()));
|
||||
if(!isReferenceToResourceVariable) return;
|
||||
holder.registerProblem(last, JavaBundle.message("inspection.redundant.explicit.close"),
|
||||
ProblemHighlightType.LIKE_UNUSED_SYMBOL, new DeleteRedundantCloseFix());
|
||||
holder.registerProblem(last, JavaBundle.message("inspection.redundant.explicit.close"), new DeleteRedundantCloseFix());
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInspection;
|
||||
|
||||
import com.intellij.java.JavaBundle;
|
||||
@@ -69,7 +69,7 @@ public class RedundantFileCreationInspection extends AbstractBaseJavaLocalInspec
|
||||
|
||||
holder.registerProblem(arg,
|
||||
JavaBundle.message("inspection.redundant.file.creation.description"),
|
||||
ProblemHighlightType.LIKE_UNUSED_SYMBOL,
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
|
||||
new TextRange(0, fileArgList.getStartOffsetInParent()),
|
||||
new DeleteRedundantFileCreationFix());
|
||||
|
||||
|
||||
+9
-6
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInspection;
|
||||
|
||||
import com.intellij.codeInsight.AnnotationTargetUtil;
|
||||
@@ -24,7 +24,10 @@ import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
public class RedundantRecordConstructorInspection extends AbstractBaseJavaLocalInspectionTool {
|
||||
@Override
|
||||
@@ -51,12 +54,12 @@ public class RedundantRecordConstructorInspection extends AbstractBaseJavaLocalI
|
||||
PsiIdentifier nameIdentifier = ctor.getNameIdentifier();
|
||||
if (nameIdentifier == null) return;
|
||||
holder.registerProblem(nameIdentifier, JavaBundle.message("inspection.redundant.record.constructor.canonical.message"),
|
||||
ProblemHighlightType.LIKE_UNUSED_SYMBOL, simplifier);
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING, simplifier);
|
||||
}
|
||||
else if (simplifier instanceof MakeCtorCompactSimplifier) {
|
||||
holder.registerProblem(ctor.getParameterList(),
|
||||
JavaBundle.message("inspection.redundant.record.constructor.can.be.compact.message"),
|
||||
ProblemHighlightType.LIKE_UNUSED_SYMBOL, simplifier);
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING, simplifier);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +77,7 @@ public class RedundantRecordConstructorInspection extends AbstractBaseJavaLocalI
|
||||
for (int i = statements.length - count; i < statements.length; i++) {
|
||||
holder.registerProblem(statements[i],
|
||||
JavaBundle.message("inspection.redundant.record.constructor.statement.message"),
|
||||
ProblemHighlightType.LIKE_UNUSED_SYMBOL, new DeleteElementFix(statements[i]));
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING, new DeleteElementFix(statements[i]));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -83,7 +86,7 @@ public class RedundantRecordConstructorInspection extends AbstractBaseJavaLocalI
|
||||
ctor.getDocComment() == null) {
|
||||
holder.registerProblem(ctorNameIdentifier,
|
||||
JavaBundle.message("inspection.redundant.record.constructor.compact.message"),
|
||||
ProblemHighlightType.LIKE_UNUSED_SYMBOL, new RemoveRedundantCtorSimplifier());
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING, new RemoveRedundantCtorSimplifier());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInspection;
|
||||
|
||||
import com.intellij.codeInspection.ui.SingleCheckboxOptionsPanel;
|
||||
@@ -119,7 +119,7 @@ public class RedundantStreamOptionalCallInspection extends AbstractBaseJavaLocal
|
||||
!isIdentityMapping(qualifierCall.getArgumentList().getExpressions()[0], false)) {
|
||||
String message = JavaBundle.message("inspection.redundant.stream.optional.call.message", name) +
|
||||
": " + JavaBundle.message("inspection.redundant.stream.optional.call.explanation.map.flatMap");
|
||||
holder.registerProblem(call, message, ProblemHighlightType.LIKE_UNUSED_SYMBOL, getRange(call),
|
||||
holder.registerProblem(call, message, ProblemHighlightType.GENERIC_ERROR_OR_WARNING, getRange(call),
|
||||
new RemoveCallFix(name, "flatMap"));
|
||||
}
|
||||
}
|
||||
@@ -237,7 +237,7 @@ public class RedundantStreamOptionalCallInspection extends AbstractBaseJavaLocal
|
||||
String message = explanation != null
|
||||
? JavaBundle.message("inspection.redundant.stream.optional.call.message.with.explanation", methodName, explanation)
|
||||
: JavaBundle.message("inspection.redundant.stream.optional.call.message", methodName);
|
||||
holder.registerProblem(call, message, ProblemHighlightType.LIKE_UNUSED_SYMBOL, getRange(call),
|
||||
holder.registerProblem(call, message, ProblemHighlightType.GENERIC_ERROR_OR_WARNING, getRange(call),
|
||||
ArrayUtil.prepend(new RemoveCallFix(methodName), additionalFixes));
|
||||
}
|
||||
};
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInspection;
|
||||
|
||||
import com.intellij.codeInspection.dataFlow.CommonDataflow;
|
||||
@@ -41,7 +41,7 @@ public class RedundantUnmodifiableInspection extends AbstractBaseJavaLocalInspec
|
||||
|
||||
holder.registerProblem(call,
|
||||
JavaBundle.message("inspection.redundant.unmodifiable.call.display.name", methodName),
|
||||
ProblemHighlightType.LIKE_UNUSED_SYMBOL,
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
|
||||
new TextRange(0, call.getArgumentList().getStartOffsetInParent()),
|
||||
new UnwrapUnmodifiableFix());
|
||||
}
|
||||
|
||||
+1
-2
@@ -142,7 +142,6 @@ public class DefUseInspection extends AbstractBaseJavaLocalInspectionTool {
|
||||
isOnTheFlyOrNoSideEffects(holder.isOnTheFly(), psiVariable, psiVariable.getInitializer()) ? new RemoveInitializerFix() : null);
|
||||
holder.registerProblem(ObjectUtils.notNull(psiVariable.getInitializer(), psiVariable),
|
||||
JavaBundle.message("inspection.unused.assignment.problem.descriptor2", psiVariable.getName()),
|
||||
ProblemHighlightType.LIKE_UNUSED_SYMBOL,
|
||||
fixes.toArray(LocalQuickFix.EMPTY_ARRAY)
|
||||
);
|
||||
}
|
||||
@@ -155,7 +154,7 @@ public class DefUseInspection extends AbstractBaseJavaLocalInspectionTool {
|
||||
holder.registerProblem(assignment.getLExpression(),
|
||||
JavaBundle.message("inspection.unused.assignment.problem.descriptor3",
|
||||
Objects.requireNonNull(assignment.getRExpression()).getText()),
|
||||
ProblemHighlightType.LIKE_UNUSED_SYMBOL, fixes.toArray(LocalQuickFix.EMPTY_ARRAY)
|
||||
fixes.toArray(LocalQuickFix.EMPTY_ARRAY)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+5
-3
@@ -1,8 +1,11 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInspection.enhancedSwitch;
|
||||
|
||||
import com.intellij.codeInsight.daemon.impl.analysis.HighlightingFeature;
|
||||
import com.intellij.codeInspection.*;
|
||||
import com.intellij.codeInspection.LocalInspectionTool;
|
||||
import com.intellij.codeInspection.LocalQuickFix;
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.codeInspection.ProblemsHolder;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
@@ -51,7 +54,6 @@ public class RedundantLabeledSwitchRuleCodeBlockInspection extends LocalInspecti
|
||||
if (element != null) {
|
||||
holder.registerProblem(element,
|
||||
message("inspection.labeled.switch.rule.redundant.code.block.message"),
|
||||
ProblemHighlightType.LIKE_UNUSED_SYMBOL,
|
||||
new UnwrapCodeBlockFix());
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInspection.lambdaToExplicit;
|
||||
|
||||
import com.intellij.codeInspection.*;
|
||||
@@ -57,7 +57,7 @@ public class ExcessiveLambdaUsageInspection extends AbstractBaseJavaLocalInspect
|
||||
|
||||
private void registerProblem(PsiLambdaExpression lambda, PsiExpression expr, LocalQuickFix fix) {
|
||||
holder.registerProblem(lambda, JavaBundle.message("inspection.excessive.lambda.message"),
|
||||
ProblemHighlightType.LIKE_UNUSED_SYMBOL,
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
|
||||
new TextRange(0, expr.getStartOffsetInParent()),
|
||||
fix);
|
||||
}
|
||||
|
||||
+6
-18
@@ -1,21 +1,10 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInspection.sillyAssignment;
|
||||
|
||||
import com.intellij.codeInspection.*;
|
||||
import com.intellij.codeInspection.AbstractBaseJavaLocalInspectionTool;
|
||||
import com.intellij.codeInspection.LocalQuickFix;
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.codeInspection.ProblemsHolder;
|
||||
import com.intellij.java.JavaBundle;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
@@ -88,7 +77,6 @@ public class SillyAssignmentInspection extends AbstractBaseJavaLocalInspectionTo
|
||||
if (refExpr.isReferenceTo(variable)) {
|
||||
holder.registerProblem(refExpr,
|
||||
JavaBundle.message("assignment.to.declared.variable.problem.descriptor", variable.getName()),
|
||||
ProblemHighlightType.LIKE_UNUSED_SYMBOL,
|
||||
createRemoveAssignmentFix(refExpr));
|
||||
}
|
||||
}
|
||||
@@ -124,7 +112,7 @@ public class SillyAssignmentInspection extends AbstractBaseJavaLocalInspectionTo
|
||||
PsiManager manager = assignment.getManager();
|
||||
if (!sameInstanceReferences(lRef, rRef, manager)) return;
|
||||
holder.registerProblem(rRef, JavaBundle.message("assignment.to.itself.problem.descriptor", variable.getName()),
|
||||
ProblemHighlightType.LIKE_UNUSED_SYMBOL, createRemoveAssignmentFix(rRef));
|
||||
createRemoveAssignmentFix(rRef));
|
||||
}
|
||||
|
||||
private static PsiExpression deparenthesizeRExpr(PsiExpression rExpression, PsiVariable variable) {
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ public class ParameterCanBeLocalInspection extends AbstractBaseJavaLocalInspecti
|
||||
identifier,
|
||||
JavaBundle.message("inspection.parameter.can.be.local.problem.descriptor"),
|
||||
true,
|
||||
ProblemHighlightType.LIKE_UNUSED_SYMBOL,
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
|
||||
isOnTheFly,
|
||||
new ConvertParameterToLocalQuickFix()
|
||||
);
|
||||
|
||||
@@ -1422,7 +1422,7 @@
|
||||
groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.declaration.redundancy" enabledByDefault="true" level="WARNING"
|
||||
bundle="messages.JavaBundle"
|
||||
key="inspection.redundant.explicit.close"
|
||||
key="inspection.redundant.explicit.close" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.intellij.codeInspection.RedundantExplicitCloseInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="SuspiciousTernaryOperatorInVarargsCall"
|
||||
groupBundle="messages.InspectionsBundle"
|
||||
@@ -1433,7 +1433,7 @@
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="RedundantFileCreation"
|
||||
groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.verbose.or.redundant.code.constructs" enabledByDefault="true" level="WARNING"
|
||||
bundle="messages.JavaBundle"
|
||||
bundle="messages.JavaBundle" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
key="inspection.redundant.file.creation.display.name"
|
||||
implementationClass="com.intellij.codeInspection.RedundantFileCreationInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="ScheduledThreadPoolExecutorWithZeroCoreThreads"
|
||||
@@ -1457,7 +1457,7 @@
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="RedundantUnmodifiable"
|
||||
groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.verbose.or.redundant.code.constructs" enabledByDefault="true" level="WARNING"
|
||||
bundle="messages.JavaBundle"
|
||||
bundle="messages.JavaBundle" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
key="inspection.redundant.unmodifiable.call.description"
|
||||
implementationClass="com.intellij.codeInspection.RedundantUnmodifiableInspection"/>
|
||||
<localInspection groupPathKey="group.path.names.java.language.level.specific.issues.and.migration.aids" language="JAVA" shortName="TextBlockMigration"
|
||||
@@ -1490,7 +1490,7 @@
|
||||
<localInspection groupPathKey="group.path.names.java.language.level.specific.issues.and.migration.aids" language="JAVA" shortName="ComparatorCombinators"
|
||||
groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.language.level.specific.issues.and.migration.aids8" enabledByDefault="true" level="WARNING"
|
||||
implementationClass="com.intellij.codeInspection.ComparatorCombinatorsInspection"
|
||||
implementationClass="com.intellij.codeInspection.ComparatorCombinatorsInspection" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
key="inspection.comparator.combinators.display.name" bundle="messages.JavaBundle"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="UseBulkOperation"
|
||||
groupBundle="messages.InspectionsBundle"
|
||||
@@ -1532,11 +1532,11 @@
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="RedundantStreamOptionalCall"
|
||||
groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.verbose.or.redundant.code.constructs" enabledByDefault="true" level="WARNING"
|
||||
implementationClass="com.intellij.codeInspection.RedundantStreamOptionalCallInspection"
|
||||
implementationClass="com.intellij.codeInspection.RedundantStreamOptionalCallInspection" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
key="inspection.redundant.stream.optional.call.display.name" bundle="messages.JavaBundle"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="RedundantRecordConstructor" enabledByDefault="true" level="WARNING"
|
||||
groupBundle="messages.InspectionsBundle" groupKey="group.names.declaration.redundancy"
|
||||
bundle="messages.JavaBundle" key="inspection.redundant.record.constructor.description"
|
||||
bundle="messages.JavaBundle" key="inspection.redundant.record.constructor.description" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.intellij.codeInspection.RedundantRecordConstructorInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="MeaninglessRecordAnnotationInspection" enabledByDefault="true" level="WARNING"
|
||||
groupBundle="messages.InspectionsBundle" groupKey="group.names.probable.bugs"
|
||||
@@ -1560,6 +1560,7 @@
|
||||
groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.verbose.or.redundant.code.constructs" enabledByDefault="true" level="WARNING"
|
||||
implementationClass="com.intellij.codeInspection.lambdaToExplicit.ExcessiveLambdaUsageInspection"
|
||||
editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
key="inspection.excessive.lambda.usage.display.name" bundle="messages.JavaBundle"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="ExplicitArgumentCanBeLambda"
|
||||
groupBundle="messages.InspectionsBundle"
|
||||
@@ -1638,7 +1639,7 @@
|
||||
key="inspection.magic.constant.display.name" bundle="messages.JavaBundle"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="TrivialFunctionalExpressionUsage"
|
||||
groupKey="group.names.declaration.redundancy" groupBundle="messages.InspectionsBundle" enabledByDefault="true" level="WARNING"
|
||||
implementationClass="com.intellij.codeInspection.TrivialFunctionalExpressionUsageInspection"
|
||||
implementationClass="com.intellij.codeInspection.TrivialFunctionalExpressionUsageInspection" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
key="inspection.trivial.functional.expression.usage.display.name" bundle="messages.JavaBundle"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="FunctionalExpressionCanBeFolded"
|
||||
groupKey="group.names.declaration.redundancy" groupBundle="messages.InspectionsBundle" enabledByDefault="true" level="WARNING"
|
||||
@@ -1654,7 +1655,7 @@
|
||||
key="inspection.convert.2.method.ref.display.name" bundle="messages.JavaBundle"/>
|
||||
<localInspection groupPathKey="group.path.names.java.language.level.specific.issues.and.migration.aids" language="JAVA" shortName="Anonymous2MethodRef"
|
||||
groupKey="group.names.language.level.specific.issues.and.migration.aids8" groupBundle="messages.InspectionsBundle" enabledByDefault="true" level="WARNING"
|
||||
implementationClass="com.intellij.codeInspection.AnonymousCanBeMethodReferenceInspection"
|
||||
implementationClass="com.intellij.codeInspection.AnonymousCanBeMethodReferenceInspection" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
key="inspection.anonymous.2.method.ref.display.name" bundle="messages.JavaBundle"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="StreamToLoop"
|
||||
groupKey="group.names.code.style.issues" groupBundle="messages.InspectionsBundle" enabledByDefault="true" level="INFORMATION"
|
||||
@@ -1697,11 +1698,11 @@
|
||||
implementationClass="com.intellij.codeInspection.accessStaticViaInstance.AccessStaticViaInstance" />
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="DefaultAnnotationParam" bundle="messages.JavaBundle" key="inspection.default.annotation.param"
|
||||
groupKey="group.names.declaration.redundancy" groupBundle="messages.InspectionsBundle"
|
||||
enabledByDefault="true" level="WARNING"
|
||||
enabledByDefault="true" level="WARNING" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.intellij.codeInspection.DefaultAnnotationParamInspection" />
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="SillyAssignment" bundle="messages.JavaBundle" key="inspection.variable.assigned.to.itself.display.name"
|
||||
groupKey="group.names.declaration.redundancy" groupBundle="messages.InspectionsBundle"
|
||||
enabledByDefault="true" level="WARNING"
|
||||
enabledByDefault="true" level="WARNING" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.intellij.codeInspection.sillyAssignment.SillyAssignmentInspection" />
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="WrongPackageStatement" bundle="messages.JavaBundle" key="wrong.package.statement"
|
||||
groupKey="group.names.probable.bugs" groupBundle="messages.InspectionsBundle"
|
||||
@@ -1717,7 +1718,9 @@
|
||||
groupKey="group.names.nullability.problems" groupBundle="messages.InspectionsBundle" enabledByDefault="true" level="WARNING"
|
||||
implementationClass="com.intellij.codeInspection.nullable.NotNullFieldNotInitializedInspection" />
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="ParameterCanBeLocal" key="inspection.parameter.can.be.local.display.name"
|
||||
groupKey="group.names.class.structure" groupBundle="messages.InspectionsBundle" enabledByDefault="true" level="WARNING" bundle="messages.JavaBundle"
|
||||
groupKey="group.names.class.structure" groupBundle="messages.InspectionsBundle" enabledByDefault="true"
|
||||
editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
level="WARNING" bundle="messages.JavaBundle"
|
||||
implementationClass="com.intellij.codeInspection.varScopeCanBeNarrowed.ParameterCanBeLocalInspection" />
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="FieldCanBeLocal" bundle="messages.JavaBundle" key="inspection.field.can.be.local.display.name"
|
||||
groupKey="group.names.class.structure" groupBundle="messages.InspectionsBundle" enabledByDefault="true" level="WARNING" runForWholeFile="true"
|
||||
@@ -1773,7 +1776,7 @@
|
||||
enabledByDefault="true" level="WARNING" cleanupTool="true"
|
||||
implementationClass="com.intellij.codeInspection.CharsetObjectCanBeUsedInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="UnusedAssignment" groupKey="group.names.probable.bugs" groupBundle="messages.InspectionsBundle" enabledByDefault="true"
|
||||
level="WARNING" implementationClass="com.intellij.codeInspection.defUse.DefUseInspection"
|
||||
level="WARNING" implementationClass="com.intellij.codeInspection.defUse.DefUseInspection" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
key="inspection.unused.assignment.display.name" bundle="messages.JavaBundle"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="ConstantConditions" bundle="messages.JavaBundle" key="inspection.data.flow.display.name"
|
||||
groupKey="group.names.probable.bugs" groupBundle="messages.InspectionsBundle" enabledByDefault="true" level="WARNING"
|
||||
@@ -1785,7 +1788,7 @@
|
||||
implementationClass="com.intellij.codeInspection.java19api.Java9UndeclaredServiceUsageInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="RedundantComparatorComparing"
|
||||
groupBundle="messages.InspectionsBundle" groupKey="group.names.verbose.or.redundant.code.constructs"
|
||||
enabledByDefault="true" level="WARNING"
|
||||
enabledByDefault="true" level="WARNING" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
key="inspection.simplifiable.comparator.display.name" bundle="messages.JavaBundle"
|
||||
implementationClass="com.intellij.codeInspection.RedundantComparatorComparingInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="SuspiciousListRemoveInLoop"
|
||||
@@ -1836,7 +1839,7 @@
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="RedundantLabeledSwitchRuleCodeBlock"
|
||||
key="inspection.labeled.switch.rule.redundant.code.block.display.name" bundle="messages.JavaBundle"
|
||||
groupKey="group.names.code.style.issues" groupBundle="messages.InspectionsBundle"
|
||||
enabledByDefault="true" level="WARNING"
|
||||
enabledByDefault="true" level="WARNING" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.intellij.codeInspection.enhancedSwitch.RedundantLabeledSwitchRuleCodeBlockInspection" />
|
||||
<localInspection groupPathKey="group.path.names.java.language.level.specific.issues.and.migration.aids" language="JAVA" shortName="EnhancedSwitchBackwardMigration"
|
||||
key="inspection.switch.expression.backward.migration.inspection.name" bundle="messages.JavaBundle"
|
||||
@@ -1901,6 +1904,7 @@
|
||||
groupKey="group.names.declaration.redundancy" enabledByDefault="true" level="WARNING"
|
||||
implementationClass="com.intellij.codeInspection.deadCode.UnusedDeclarationInspection"
|
||||
presentation="com.intellij.codeInspection.deadCode.UnusedDeclarationPresentation" key="inspection.unused.display.name"
|
||||
editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
bundle="messages.JavaBundle"/>
|
||||
|
||||
<intentionAction>
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInspection;
|
||||
|
||||
import com.intellij.codeInspection.LambdaCanBeMethodReferenceInspection.MethodReferenceCandidate;
|
||||
@@ -81,7 +81,7 @@ public class AnonymousCanBeMethodReferenceInspection extends AbstractBaseJavaLoc
|
||||
final TextRange rangeInElement = new TextRange(0, aClass.getStartOffsetInParent() + lBrace.getStartOffsetInParent());
|
||||
ProblemHighlightType type;
|
||||
if (methodReferenceCandidate.mySafeQualifier && methodReferenceCandidate.myConformsCodeStyle) {
|
||||
type = ProblemHighlightType.LIKE_UNUSED_SYMBOL;
|
||||
type = ProblemHighlightType.GENERIC_ERROR_OR_WARNING;
|
||||
}
|
||||
else {
|
||||
if (!isOnTheFly) return;
|
||||
|
||||
+1
-1
@@ -338,7 +338,7 @@ public final class UnusedDeclarationInspection extends UnusedDeclarationInspecti
|
||||
PsiElement toHighlight = ObjectUtils.notNull(psiVariable.getNameIdentifier(), psiVariable);
|
||||
return myInspectionManager.createProblemDescriptor(
|
||||
toHighlight, JavaBundle.message("inspection.unused.assignment.problem.descriptor1"), (LocalQuickFix)null,
|
||||
ProblemHighlightType.LIKE_UNUSED_SYMBOL, false);
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ class UnusedParametersInspection extends GlobalJavaBatchInspectionTool {
|
||||
? "inspection.unused.parameter.composer"
|
||||
: "inspection.unused.parameter.composer1"),
|
||||
new AcceptSuggested(globalContext.getRefManager(), processor, refParameter.getName()),
|
||||
ProblemHighlightType.LIKE_UNUSED_SYMBOL, false));
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING, false));
|
||||
}
|
||||
}
|
||||
return result.toArray(CommonProblemDescriptor.EMPTY_ARRAY);
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Unwrap code block of labeled rule" "LIKE_UNUSED_SYMBOL"
|
||||
// "Unwrap code block of labeled rule" "GENERIC_ERROR_OR_WARNING"
|
||||
class C {
|
||||
String foo(int n) {
|
||||
return switch (n) {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Unwrap code block of labeled rule" "LIKE_UNUSED_SYMBOL"
|
||||
// "Unwrap code block of labeled rule" "GENERIC_ERROR_OR_WARNING"
|
||||
class C {
|
||||
void foo(int n) {
|
||||
String s;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Unwrap code block of labeled rule" "LIKE_UNUSED_SYMBOL"
|
||||
// "Unwrap code block of labeled rule" "GENERIC_ERROR_OR_WARNING"
|
||||
class C {
|
||||
String foo(int n) {
|
||||
return switch (n) {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Unwrap code block of labeled rule" "LIKE_UNUSED_SYMBOL"
|
||||
// "Unwrap code block of labeled rule" "GENERIC_ERROR_OR_WARNING"
|
||||
class C {
|
||||
int foo(final int x, int n) {
|
||||
return switch (x) {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Unwrap code block of labeled rule" "LIKE_UNUSED_SYMBOL"
|
||||
// "Unwrap code block of labeled rule" "GENERIC_ERROR_OR_WARNING"
|
||||
class C {
|
||||
String foo(int n) {
|
||||
return switch (n) {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Unwrap code block of labeled rule" "LIKE_UNUSED_SYMBOL"
|
||||
// "Unwrap code block of labeled rule" "GENERIC_ERROR_OR_WARNING"
|
||||
class C {
|
||||
String foo(int n) {
|
||||
switch (n) {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Unwrap code block of labeled rule" "LIKE_UNUSED_SYMBOL"
|
||||
// "Unwrap code block of labeled rule" "GENERIC_ERROR_OR_WARNING"
|
||||
class C {
|
||||
String foo(int n) {
|
||||
return switch (n) {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Unwrap code block of labeled rule" "LIKE_UNUSED_SYMBOL"
|
||||
// "Unwrap code block of labeled rule" "GENERIC_ERROR_OR_WARNING"
|
||||
class C {
|
||||
void foo(int n) {
|
||||
String s;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Unwrap code block of labeled rule" "LIKE_UNUSED_SYMBOL"
|
||||
// "Unwrap code block of labeled rule" "GENERIC_ERROR_OR_WARNING"
|
||||
class C {
|
||||
String foo(int n) {
|
||||
return switch (n) {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Unwrap code block of labeled rule" "LIKE_UNUSED_SYMBOL"
|
||||
// "Unwrap code block of labeled rule" "GENERIC_ERROR_OR_WARNING"
|
||||
class C {
|
||||
int foo(final int x, int n) {
|
||||
return switch (x) {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Unwrap code block of labeled rule" "LIKE_UNUSED_SYMBOL"
|
||||
// "Unwrap code block of labeled rule" "GENERIC_ERROR_OR_WARNING"
|
||||
class C {
|
||||
String foo(int n) {
|
||||
return switch (n) {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Unwrap code block of labeled rule" "LIKE_UNUSED_SYMBOL"
|
||||
// "Unwrap code block of labeled rule" "GENERIC_ERROR_OR_WARNING"
|
||||
class C {
|
||||
String foo(int n) {
|
||||
switch (n) {
|
||||
|
||||
@@ -201,9 +201,7 @@ public class InspectionProfileTest extends LightIdeaTestCase {
|
||||
public void testCustomTextAttributes() throws IOException, JDOMException {
|
||||
@Language("XML") String content = "<profile version=\"1.0\">\n" +
|
||||
" <option name=\"myName\" value=\"default\" />\n" +
|
||||
" <inspection_tool class=\"Convert2Lambda\" enabled=\"false\" level=\"WARNING\" enabled_by_default=\"false\">\n" +
|
||||
" <option name=\"myExternalName\" value=\"NOT_USED_ELEMENT_ATTRIBUTES\"/>\n" +
|
||||
" </inspection_tool>\n" +
|
||||
" <inspection_tool class=\"Convert2Lambda\" enabled=\"false\" level=\"WARNING\" enabled_by_default=\"false\" editorAttributes=\"NOT_USED_ELEMENT_ATTRIBUTES\"/>\n" +
|
||||
"</profile>";
|
||||
InspectionProfileImpl profile = createProfile();
|
||||
readFromXml(profile, content);
|
||||
@@ -727,7 +725,7 @@ public class InspectionProfileTest extends LightIdeaTestCase {
|
||||
});
|
||||
String mergedText = "<profile version=\"1.0\">\n" +
|
||||
" <option name=\"myName\" value=\"ToConvert\" />\n" +
|
||||
" <inspection_tool class=\"unused\" enabled=\"true\" level=\"WARNING\" enabled_by_default=\"true\" checkParameterExcludingHierarchy=\"false\">\n" +
|
||||
" <inspection_tool class=\"unused\" enabled=\"true\" level=\"WARNING\" enabled_by_default=\"true\" editorAttributes=\"NOT_USED_ELEMENT_ATTRIBUTES\" checkParameterExcludingHierarchy=\"false\">\n" +
|
||||
" <option name=\"LOCAL_VARIABLE\" value=\"true\" />\n" +
|
||||
" <option name=\"FIELD\" value=\"true\" />\n" +
|
||||
" <option name=\"METHOD\" value=\"true\" />\n" +
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInspection.ex
|
||||
|
||||
import com.intellij.codeHighlighting.HighlightDisplayLevel
|
||||
@@ -136,7 +136,7 @@ class ProjectInspectionManagerTest {
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="Convert2Diamond" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="Convert2Diamond" enabled="false" level="WARNING" enabled_by_default="false" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES" />
|
||||
</profile>
|
||||
</component>""".trimIndent())
|
||||
|
||||
@@ -251,7 +251,7 @@ class ProjectInspectionManagerTest {
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="Convert2Diamond" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="Convert2Diamond" enabled="false" level="WARNING" enabled_by_default="false" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES" />
|
||||
</profile>
|
||||
<version value="1.0" />
|
||||
</component>
|
||||
|
||||
@@ -237,6 +237,12 @@ public class InspectionEP extends LanguageExtensionPoint<InspectionProfileEntry>
|
||||
@Attribute("isInternal")
|
||||
public boolean isInternal;
|
||||
|
||||
/**
|
||||
* TextAttributesKey's external name
|
||||
*/
|
||||
@Attribute("editorAttributes")
|
||||
public String editorAttributes;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "InspectionEP{" +
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInspection;
|
||||
|
||||
import com.intellij.codeHighlighting.HighlightDisplayLevel;
|
||||
@@ -27,7 +27,10 @@ import com.intellij.util.containers.HashingStrategy;
|
||||
import com.intellij.util.xmlb.SerializationFilter;
|
||||
import com.intellij.util.xmlb.annotations.Property;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.*;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.io.BufferedReader;
|
||||
@@ -482,6 +485,17 @@ public abstract class InspectionProfileEntry implements BatchSuppressableTool {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Do not override the method, register attributes in plugin.xml
|
||||
*
|
||||
* @return attributesKey's external name if editor presentation should be different from severity presentation
|
||||
* {@code null} if attributes should correspond to chosen severity
|
||||
*/
|
||||
public String getEditorAttributesKey() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static @Nls String getGeneralGroupName() {
|
||||
return InspectionsBundle.message("inspection.general.tools.group.name");
|
||||
}
|
||||
|
||||
@@ -37,12 +37,6 @@ public class LocalInspectionEP extends InspectionEP implements LocalInspectionTo
|
||||
@Attribute("dynamicGroup")
|
||||
public boolean dynamicGroup;
|
||||
|
||||
/**
|
||||
* TextAttributesKey's external name
|
||||
*/
|
||||
@Attribute("editorAttributes")
|
||||
public String editorAttributes;
|
||||
|
||||
@Override
|
||||
public String getDefaultID() {
|
||||
return id;
|
||||
|
||||
@@ -66,16 +66,6 @@ public abstract class LocalInspectionTool extends InspectionProfileEntry {
|
||||
return getID();
|
||||
}
|
||||
|
||||
/**
|
||||
* Do not override the method, register attributes in plugin.xml
|
||||
*
|
||||
* @return attributesKey's external name if editor presentation should be different from severity presentation
|
||||
* {@code null} if attributes should correspond to chosen severity
|
||||
*/
|
||||
public String getEditorAttributesKey() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNls
|
||||
@Nullable
|
||||
|
||||
@@ -142,7 +142,12 @@ public abstract class InspectionToolWrapper<T extends InspectionProfileEntry, E
|
||||
}
|
||||
|
||||
public String getEditorAttributesKeyExternalName() {
|
||||
return null;
|
||||
if (myEP != null) {
|
||||
return myEP.editorAttributes;
|
||||
}
|
||||
else {
|
||||
return getTool().getEditorAttributesKey();
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -41,7 +41,6 @@ public final class ScopeToolState {
|
||||
@NotNull HighlightDisplayLevel level) {
|
||||
this(scope.getScopeId(), toolWrapper, enabled, level);
|
||||
myScope = scope;
|
||||
myTextAttributesKey = toolWrapper.getEditorAttributesKeyExternalName();
|
||||
}
|
||||
|
||||
public ScopeToolState(@NotNull String scopeName,
|
||||
|
||||
-10
@@ -45,16 +45,6 @@ public class LocalInspectionToolWrapper extends InspectionToolWrapper<LocalInspe
|
||||
return myEP == null ? getTool().getID() : myEP.id == null ? myEP.getShortName() : myEP.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEditorAttributesKeyExternalName() {
|
||||
if (myEP != null) {
|
||||
return myEP.editorAttributes;
|
||||
}
|
||||
else {
|
||||
return getTool().getEditorAttributesKey();
|
||||
}
|
||||
}
|
||||
|
||||
public @Nullable String getAlternativeID() {
|
||||
return myEP == null ? getTool().getAlternativeID() : myEP.alternativeId;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import com.intellij.lang.injection.InjectedLanguageManager;
|
||||
import com.intellij.openapi.editor.colors.TextAttributesKey;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.JDOMExternalizerUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.packageDependencies.DependencyValidationManager;
|
||||
import com.intellij.profile.ProfileEx;
|
||||
@@ -134,7 +133,7 @@ public final class ToolsImpl implements Tools {
|
||||
scopeElement.setAttribute(ENABLED_ATTRIBUTE, Boolean.toString(state.isEnabled()));
|
||||
String keyExternalName = state.getTextAttributesKeyExternalName();
|
||||
if (keyExternalName != null) {
|
||||
JDOMExternalizerUtil.writeField(scopeElement, "myExternalName", keyExternalName);
|
||||
scopeElement.setAttribute("editorAttributes", keyExternalName);
|
||||
}
|
||||
InspectionToolWrapper<?,?> toolWrapper = state.getTool();
|
||||
if (toolWrapper.isInitialized()) {
|
||||
@@ -148,7 +147,7 @@ public final class ToolsImpl implements Tools {
|
||||
inspectionElement.setAttribute(ENABLED_BY_DEFAULT_ATTRIBUTE, Boolean.toString(myDefaultState.isEnabled()));
|
||||
@Nullable String attributesKey = myDefaultState.getTextAttributesKeyExternalName();
|
||||
if (attributesKey != null) {
|
||||
JDOMExternalizerUtil.writeField(inspectionElement, "myExternalName", attributesKey);
|
||||
inspectionElement.setAttribute("editorAttributes", attributesKey);
|
||||
}
|
||||
InspectionToolWrapper<?,?> toolWrapper = myDefaultState.getTool();
|
||||
if (toolWrapper.isInitialized()) {
|
||||
@@ -167,9 +166,9 @@ public final class ToolsImpl implements Tools {
|
||||
}
|
||||
myDefaultState.setLevel(level);
|
||||
InspectionToolWrapper<?,?> toolWrapper = myDefaultState.getTool();
|
||||
String attr = JDOMExternalizerUtil.readField(toolElement, "myExternalName");
|
||||
if (attr != null) {
|
||||
myDefaultState.setTextAttributesKey(attr);
|
||||
String editorAttributes = toolElement.getAttributeValue("editorAttributes");
|
||||
if (editorAttributes != null) {
|
||||
myDefaultState.setTextAttributesKey(editorAttributes);
|
||||
}
|
||||
String enabled = toolElement.getAttributeValue(ENABLED_ATTRIBUTE);
|
||||
boolean isEnabled = Boolean.parseBoolean(enabled);
|
||||
@@ -210,9 +209,9 @@ public final class ToolsImpl implements Tools {
|
||||
state = addTool(scopeName, copyToolWrapper, Boolean.parseBoolean(enabledInScope), scopeLevel);
|
||||
}
|
||||
|
||||
attr = JDOMExternalizerUtil.readField(scopeElement, "myExternalName");
|
||||
if (attr != null) {
|
||||
state.setTextAttributesKey(attr);
|
||||
editorAttributes = scopeElement.getAttributeValue("editorAttributes");
|
||||
if (editorAttributes != null) {
|
||||
state.setTextAttributesKey(editorAttributes);
|
||||
}
|
||||
scopeNames.add(scopeName);
|
||||
}
|
||||
|
||||
+1
-2
@@ -16,7 +16,6 @@
|
||||
package com.siyeh.ig.classlayout;
|
||||
|
||||
import com.intellij.codeInsight.AnnotationUtil;
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.psi.*;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
import com.siyeh.ig.BaseInspection;
|
||||
@@ -67,7 +66,7 @@ public class FinalMethodInFinalClassInspection extends BaseInspection {
|
||||
for (final PsiElement child : children) {
|
||||
final String text = child.getText();
|
||||
if (PsiModifier.FINAL.equals(text)) {
|
||||
registerError(child, ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
registerError(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ public class FinalPrivateMethodInspection extends BaseInspection {
|
||||
if (!HighlightUtil.isLegalModifierCombination(method.getModifierList())) {
|
||||
return;
|
||||
}
|
||||
registerModifierError(PsiModifier.FINAL, method, ProblemHighlightType.LIKE_UNUSED_SYMBOL, PsiModifier.FINAL);
|
||||
registerModifierError(PsiModifier.FINAL, method, ProblemHighlightType.GENERIC_ERROR_OR_WARNING, PsiModifier.FINAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -16,7 +16,6 @@
|
||||
package com.siyeh.ig.controlflow;
|
||||
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.codeInspection.ui.SingleCheckboxOptionsPanel;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
@@ -140,7 +139,7 @@ public class ConfusingElseInspection extends BaseInspection {
|
||||
if (parentCompletesNormally(statement)) {
|
||||
return;
|
||||
}
|
||||
registerError(elseToken, ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
registerError(elseToken);
|
||||
}
|
||||
|
||||
private boolean parentCompletesNormally(PsiElement element) {
|
||||
|
||||
+2
-3
@@ -1,7 +1,6 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.siyeh.ig.controlflow;
|
||||
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.psi.*;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
import com.siyeh.ig.BaseInspection;
|
||||
@@ -54,11 +53,11 @@ public class UnnecessaryBreakInspection extends BaseInspection {
|
||||
final PsiBlockStatement blockStatement = (PsiBlockStatement)exitedStatement;
|
||||
final PsiCodeBlock block = blockStatement.getCodeBlock();
|
||||
if (ControlFlowUtils.blockCompletesWithStatement(block, statement)) {
|
||||
registerError(statement.getFirstChild(), ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
registerError(statement.getFirstChild());
|
||||
}
|
||||
}
|
||||
else if (ControlFlowUtils.statementCompletesWithStatement(exitedStatement, statement)) {
|
||||
registerError(statement.getFirstChild(), ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
registerError(statement.getFirstChild());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-3
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.siyeh.ig.controlflow;
|
||||
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.codeInspection.ui.SingleCheckboxOptionsPanel;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.FileTypeUtils;
|
||||
@@ -85,11 +84,11 @@ public class UnnecessaryContinueInspection extends BaseInspection {
|
||||
final PsiBlockStatement blockStatement = (PsiBlockStatement)body;
|
||||
final PsiCodeBlock block = blockStatement.getCodeBlock();
|
||||
if (ControlFlowUtils.blockCompletesWithStatement(block, statement)) {
|
||||
registerError(statement.getFirstChild(), ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
registerError(statement.getFirstChild());
|
||||
}
|
||||
}
|
||||
else if (ControlFlowUtils.statementCompletesWithStatement(body, statement)) {
|
||||
registerError(statement.getFirstChild(), ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
registerError(statement.getFirstChild());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -42,7 +42,8 @@ import java.util.Collection;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.intellij.codeInsight.daemon.impl.analysis.SwitchBlockHighlightingModel.PatternsInSwitchBlockHighlightingModel.CompletenessResult.COMPLETE_WITHOUT_TOTAL;
|
||||
import static com.intellij.codeInspection.ProblemHighlightType.*;
|
||||
import static com.intellij.codeInspection.ProblemHighlightType.GENERIC_ERROR_OR_WARNING;
|
||||
import static com.intellij.codeInspection.ProblemHighlightType.INFORMATION;
|
||||
|
||||
public class UnnecessaryDefaultInspection extends BaseInspection {
|
||||
|
||||
@@ -167,7 +168,7 @@ public class UnnecessaryDefaultInspection extends BaseInspection {
|
||||
highlightType = INFORMATION;
|
||||
}
|
||||
else {
|
||||
highlightType = LIKE_UNUSED_SYMBOL;
|
||||
highlightType = GENERIC_ERROR_OR_WARNING;
|
||||
}
|
||||
registerError(defaultStatement.getFirstChild(), highlightType);
|
||||
}
|
||||
|
||||
+1
-2
@@ -16,7 +16,6 @@
|
||||
package com.siyeh.ig.controlflow;
|
||||
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
@@ -103,7 +102,7 @@ public class UnnecessaryLabelOnBreakStatementInspection
|
||||
return;
|
||||
}
|
||||
if (exitedStatement.equals(labelEnabledParent)) {
|
||||
registerError(labelIdentifier, ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
registerError(labelIdentifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -16,7 +16,6 @@
|
||||
package com.siyeh.ig.controlflow;
|
||||
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
@@ -84,7 +83,7 @@ public class UnnecessaryLabelOnContinueStatementInspection
|
||||
final PsiStatement labelEnabledParent = PsiTreeUtil.getParentOfType(statement, PsiLoopStatement.class);
|
||||
if (labelEnabledParent == null) return;
|
||||
if (!exitedStatement.equals(labelEnabledParent)) return;
|
||||
registerError(labelIdentifier, ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
registerError(labelIdentifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.siyeh.ig.controlflow;
|
||||
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.codeInspection.ui.SingleCheckboxOptionsPanel;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.psi.*;
|
||||
@@ -84,7 +83,7 @@ public class UnnecessaryReturnInspection extends BaseInspection {
|
||||
super.visitReturnStatement(statement);
|
||||
final Ref<Boolean> constructorRef = Ref.create();
|
||||
if (isReturnRedundant(statement, ignoreInThenBranch, true, constructorRef)) {
|
||||
registerError(statement.getFirstChild(), ProblemHighlightType.LIKE_UNUSED_SYMBOL, constructorRef.get());
|
||||
registerError(statement.getFirstChild(), constructorRef.get());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -17,7 +17,6 @@ package com.siyeh.ig.errorhandling;
|
||||
|
||||
import com.intellij.codeInsight.BlockUtils;
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
@@ -153,7 +152,7 @@ public class EmptyFinallyBlockInspection extends BaseInspection {
|
||||
final String childText = child.getText();
|
||||
if (PsiKeyword.FINALLY.equals(childText)) {
|
||||
final boolean canDeleteTry = statement.getCatchBlocks().length == 0 && statement.getResourceList() == null;
|
||||
registerError(child, ProblemHighlightType.LIKE_UNUSED_SYMBOL, Boolean.valueOf(canDeleteTry));
|
||||
registerError(child, Boolean.valueOf(canDeleteTry));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-3
@@ -16,7 +16,6 @@
|
||||
package com.siyeh.ig.imports;
|
||||
|
||||
import com.intellij.codeInspection.CleanupLocalInspectionTool;
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiImportStatement;
|
||||
import com.intellij.psi.PsiJavaCodeReferenceElement;
|
||||
@@ -69,7 +68,7 @@ public class JavaLangImportInspection extends BaseInspection implements CleanupL
|
||||
}
|
||||
if (statement.isOnDemand()) {
|
||||
if (HardcodedMethodConstants.JAVA_LANG.equals(text)) {
|
||||
registerError(statement, ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
registerError(statement);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -84,7 +83,7 @@ public class JavaLangImportInspection extends BaseInspection implements CleanupL
|
||||
if (ImportUtils.hasOnDemandImportConflict(text, statement)) {
|
||||
return;
|
||||
}
|
||||
registerError(statement, ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
registerError(statement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-3
@@ -16,7 +16,6 @@
|
||||
package com.siyeh.ig.imports;
|
||||
|
||||
import com.intellij.codeInspection.CleanupLocalInspectionTool;
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.FileTypeUtils;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
@@ -72,7 +71,7 @@ public class SamePackageImportInspection extends BaseInspection implements Clean
|
||||
final String text = importStatement.getQualifiedName();
|
||||
if (importStatement.isOnDemand()) {
|
||||
if (packageName.equals(text)) {
|
||||
registerError(importStatement, ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
registerError(importStatement);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -88,7 +87,7 @@ public class SamePackageImportInspection extends BaseInspection implements Clean
|
||||
parentName = text.substring(0, classNameIndex);
|
||||
}
|
||||
if (packageName.equals(parentName)) {
|
||||
registerError(importStatement, ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
registerError(importStatement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -131,7 +131,7 @@ public final class UnaryPlusInspection extends BaseInspection {
|
||||
// unary plus might have been used as cast to int
|
||||
return;
|
||||
}
|
||||
registerError(prefixExpression.getOperationSign(), ProblemHighlightType.LIKE_UNUSED_SYMBOL, isOnTheFly(), prefixExpression);
|
||||
registerError(prefixExpression.getOperationSign(), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, isOnTheFly(), prefixExpression);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -2,7 +2,6 @@
|
||||
package com.siyeh.ig.numeric;
|
||||
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.lang.java.parser.ExpressionParser;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
@@ -100,7 +99,7 @@ public final class UnnecessaryExplicitNumericCastInspection extends BaseInspecti
|
||||
}
|
||||
final PsiTypeElement typeElement = expression.getCastType();
|
||||
if (typeElement != null) {
|
||||
registerError(typeElement, ProblemHighlightType.LIKE_UNUSED_SYMBOL, expression.getOperand());
|
||||
registerError(typeElement, expression.getOperand());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.siyeh.ig.numeric;
|
||||
|
||||
import com.intellij.codeInspection.*;
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
@@ -172,7 +172,7 @@ public final class UnnecessaryUnaryMinusInspection extends BaseInspection {
|
||||
ContainerUtil.addIfNotNull(fixes, createRemoveDoubleUnaryMinusFix(prefixExpr));
|
||||
}
|
||||
if (!fixes.isEmpty()) {
|
||||
registerError(prefixExpr.getOperationSign(), ProblemHighlightType.LIKE_UNUSED_SYMBOL,
|
||||
registerError(prefixExpr.getOperationSign(),
|
||||
(Object)fixes.toArray(InspectionGadgetsFix.EMPTY_ARRAY));
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -16,7 +16,6 @@
|
||||
package com.siyeh.ig.redundancy;
|
||||
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
@@ -86,7 +85,7 @@ public class UnusedLabelInspection extends BaseInspection {
|
||||
return;
|
||||
}
|
||||
final PsiIdentifier labelIdentifier = statement.getLabelIdentifier();
|
||||
registerError(labelIdentifier, ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
registerError(labelIdentifier);
|
||||
}
|
||||
|
||||
private static boolean containsBreakOrContinueForLabel(PsiLabeledStatement statement) {
|
||||
|
||||
+1
-2
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.siyeh.ig.serialization;
|
||||
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiField;
|
||||
import com.intellij.psi.PsiModifier;
|
||||
@@ -59,7 +58,7 @@ public class TransientFieldInNonSerializableClassInspection extends BaseInspecti
|
||||
if (SerializationUtils.isSerializable(aClass)) {
|
||||
return;
|
||||
}
|
||||
registerModifierError(PsiModifier.TRANSIENT, field, ProblemHighlightType.LIKE_UNUSED_SYMBOL, field);
|
||||
registerModifierError(PsiModifier.TRANSIENT, field, field);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -17,7 +17,6 @@ package com.siyeh.ig.style;
|
||||
|
||||
import com.intellij.codeInspection.CleanupLocalInspectionTool;
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.codeInspection.ui.SingleCheckboxOptionsPanel;
|
||||
import com.intellij.java.analysis.JavaAnalysisBundle;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -109,7 +108,7 @@ public class RedundantFieldInitializationInspection extends BaseInspection imple
|
||||
if (isAssignmentInInitializerOverwritten(field)) {
|
||||
return;
|
||||
}
|
||||
registerError(initializer, ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
registerError(initializer);
|
||||
}
|
||||
|
||||
private boolean isAssignmentInInitializerOverwritten(@NotNull PsiField field) {
|
||||
|
||||
+3
-8
@@ -17,7 +17,6 @@ package com.siyeh.ig.style;
|
||||
|
||||
import com.intellij.codeInspection.CleanupLocalInspectionTool;
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.codeInspection.ui.MultipleCheckboxOptionsPanel;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
@@ -168,7 +167,7 @@ public class RedundantImplementsInspection extends BaseInspection implements Cle
|
||||
}
|
||||
final PsiClass extendedClass = (PsiClass)extendsReferent;
|
||||
if (extendedClass.isInheritor(implementedClass, true)) {
|
||||
register(implementsElement);
|
||||
registerError(implementsElement);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -184,16 +183,12 @@ public class RedundantImplementsInspection extends BaseInspection implements Cle
|
||||
final PsiClass testImplementedClass =
|
||||
(PsiClass)implementsReferent;
|
||||
if (testImplementedClass.isInheritor(implementedClass, true)) {
|
||||
register(implementsElement);
|
||||
registerError(implementsElement);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void register(PsiJavaCodeReferenceElement implementsElement) {
|
||||
registerError(implementsElement, ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
}
|
||||
|
||||
private void checkExtendedInterface(PsiJavaCodeReferenceElement extendsElement, PsiJavaCodeReferenceElement[] extendsElements) {
|
||||
final PsiElement target = extendsElement.resolve();
|
||||
if (!(target instanceof PsiClass)) {
|
||||
@@ -215,7 +210,7 @@ public class RedundantImplementsInspection extends BaseInspection implements Cle
|
||||
final PsiClass testExtendedInterface =
|
||||
(PsiClass)implementsReferent;
|
||||
if (testExtendedInterface.isInheritor(extendedInterface, true)) {
|
||||
register(extendsElement);
|
||||
registerError(extendsElement);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
+6
-7
@@ -17,7 +17,6 @@ package com.siyeh.ig.style;
|
||||
|
||||
import com.intellij.codeInspection.CleanupLocalInspectionTool;
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
@@ -151,7 +150,7 @@ public class SimplifiableAnnotationInspection extends BaseInspection implements
|
||||
}
|
||||
if (attributes.length == 0) {
|
||||
if (parameterList.getChildren().length > 0 && !containsError(annotation)) {
|
||||
registerError(parameterList, ProblemHighlightType.LIKE_UNUSED_SYMBOL, Boolean.FALSE);
|
||||
registerError(parameterList, Boolean.FALSE);
|
||||
}
|
||||
}
|
||||
else if (attributes.length == 1) {
|
||||
@@ -161,7 +160,7 @@ public class SimplifiableAnnotationInspection extends BaseInspection implements
|
||||
if (identifier != null && attributeValue != null) {
|
||||
@NonNls final String name = attribute.getName();
|
||||
if (PsiAnnotation.DEFAULT_REFERENCED_METHOD_NAME.equals(name) && !containsError(annotation)) {
|
||||
registerErrorAtOffset(attribute, 0, attributeValue.getStartOffsetInParent(), ProblemHighlightType.LIKE_UNUSED_SYMBOL,
|
||||
registerErrorAtOffset(attribute, 0, attributeValue.getStartOffsetInParent(),
|
||||
Boolean.FALSE);
|
||||
}
|
||||
}
|
||||
@@ -174,8 +173,8 @@ public class SimplifiableAnnotationInspection extends BaseInspection implements
|
||||
return;
|
||||
}
|
||||
if (!containsError(annotation)) {
|
||||
registerError(arrayValue.getFirstChild(), ProblemHighlightType.LIKE_UNUSED_SYMBOL, Boolean.FALSE);
|
||||
registerError(arrayValue.getLastChild(), ProblemHighlightType.LIKE_UNUSED_SYMBOL, Boolean.FALSE);
|
||||
registerError(arrayValue.getFirstChild(), Boolean.FALSE);
|
||||
registerError(arrayValue.getLastChild(), Boolean.FALSE);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -190,8 +189,8 @@ public class SimplifiableAnnotationInspection extends BaseInspection implements
|
||||
continue;
|
||||
}
|
||||
if (!containsError(annotation)) {
|
||||
registerError(arrayValue.getFirstChild(), ProblemHighlightType.LIKE_UNUSED_SYMBOL, Boolean.FALSE);
|
||||
registerError(arrayValue.getLastChild(), ProblemHighlightType.LIKE_UNUSED_SYMBOL, Boolean.FALSE);
|
||||
registerError(arrayValue.getFirstChild(), Boolean.FALSE);
|
||||
registerError(arrayValue.getLastChild(), Boolean.FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.siyeh.ig.style;
|
||||
|
||||
import com.intellij.codeInspection.CleanupLocalInspectionTool;
|
||||
@@ -125,7 +125,7 @@ public class UnnecessarilyQualifiedInnerClassAccessInspection extends BaseInspec
|
||||
if (referenceClass == null) {
|
||||
return;
|
||||
}
|
||||
ProblemHighlightType highlightType = ProblemHighlightType.LIKE_UNUSED_SYMBOL;
|
||||
ProblemHighlightType highlightType = ProblemHighlightType.GENERIC_ERROR_OR_WARNING;
|
||||
if (!referenceClass.equals(qualifierTarget) || !ClassUtils.isInsideClassBody(reference, referenceClass)) {
|
||||
if (ignoreReferencesNeedingImport &&
|
||||
(PsiTreeUtil.isAncestor(referenceClass, qualifierTarget, true) ||
|
||||
|
||||
+1
-2
@@ -17,7 +17,6 @@ package com.siyeh.ig.style;
|
||||
|
||||
import com.intellij.codeInspection.CleanupLocalInspectionTool;
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.codeInspection.ui.MultipleCheckboxOptionsPanel;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
@@ -111,7 +110,7 @@ public class UnnecessarilyQualifiedStaticUsageInspection extends BaseInspection
|
||||
if (!isUnnecessarilyQualifiedAccess(reference, m_ignoreStaticAccessFromStaticContext, m_ignoreStaticFieldAccesses, m_ignoreStaticMethodCalls)) {
|
||||
return;
|
||||
}
|
||||
registerError(qualifier, ProblemHighlightType.LIKE_UNUSED_SYMBOL, reference);
|
||||
registerError(qualifier, reference);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-2
@@ -17,7 +17,6 @@ package com.siyeh.ig.style;
|
||||
|
||||
import com.intellij.codeInspection.CleanupLocalInspectionTool;
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
@@ -78,7 +77,7 @@ public class UnnecessarilyQualifiedStaticallyImportedElementInspection extends B
|
||||
return;
|
||||
}
|
||||
if (ImportUtils.isAlreadyStaticallyImported(reference)) {
|
||||
registerError(Objects.requireNonNull(reference.getQualifier()), ProblemHighlightType.LIKE_UNUSED_SYMBOL, reference.resolve());
|
||||
registerError(Objects.requireNonNull(reference.getQualifier()), reference.resolve());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -19,7 +19,6 @@ import com.intellij.codeInsight.Nullability;
|
||||
import com.intellij.codeInspection.CleanupLocalInspectionTool;
|
||||
import com.intellij.codeInspection.CommonQuickFixBundle;
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.codeInspection.dataFlow.NullabilityUtil;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
@@ -140,7 +139,7 @@ public class UnnecessaryCallToStringValueOfInspection extends BaseInspection imp
|
||||
public void visitMethodCallExpression(PsiMethodCallExpression call) {
|
||||
final PsiExpression argument = tryUnwrapRedundantConversion(call);
|
||||
if (argument == null) return;
|
||||
registerErrorAtOffset(call, 0, call.getArgumentList().getStartOffsetInParent(), ProblemHighlightType.LIKE_UNUSED_SYMBOL,
|
||||
registerErrorAtOffset(call, 0, call.getArgumentList().getStartOffsetInParent(),
|
||||
calculateReplacementText(call, argument));
|
||||
}
|
||||
}
|
||||
|
||||
+2
-3
@@ -1,10 +1,9 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.siyeh.ig.style;
|
||||
|
||||
import com.intellij.codeInspection.CleanupLocalInspectionTool;
|
||||
import com.intellij.codeInspection.CommonQuickFixBundle;
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
@@ -101,7 +100,7 @@ public class UnnecessaryConstantArrayCreationExpressionInspection extends BaseIn
|
||||
if (hasGenericTypeParameters(variable)) {
|
||||
return;
|
||||
}
|
||||
registerErrorAtOffset(parent, 0, expression.getStartOffsetInParent(), ProblemHighlightType.LIKE_UNUSED_SYMBOL,
|
||||
registerErrorAtOffset(parent, 0, expression.getStartOffsetInParent(),
|
||||
expressionType.getPresentableText());
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -16,7 +16,6 @@
|
||||
package com.siyeh.ig.style;
|
||||
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.codeInspection.ui.SingleCheckboxOptionsPanel;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
@@ -121,7 +120,7 @@ public class UnnecessaryConstructorInspection extends BaseInspection {
|
||||
final PsiCodeBlock body = constructor.getBody();
|
||||
if (ControlFlowUtils.isEmptyCodeBlock(body) ||
|
||||
isSuperConstructorInvocationWithoutArguments(ControlFlowUtils.getOnlyStatementInBlock(body))) {
|
||||
registerError(identifier, ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
registerError(identifier);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-6
@@ -16,7 +16,6 @@
|
||||
package com.siyeh.ig.style;
|
||||
|
||||
import com.intellij.codeInspection.CleanupLocalInspectionTool;
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.codeInspection.ui.MultipleCheckboxOptionsPanel;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
@@ -115,7 +114,7 @@ public class UnnecessaryFinalOnLocalVariableOrParameterInspection extends BaseIn
|
||||
}
|
||||
}
|
||||
final PsiLocalVariable variable = (PsiLocalVariable)firstElement;
|
||||
registerModifierError(PsiModifier.FINAL, variable, ProblemHighlightType.LIKE_UNUSED_SYMBOL, variable);
|
||||
registerModifierError(PsiModifier.FINAL, variable, variable);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -136,7 +135,7 @@ public class UnnecessaryFinalOnLocalVariableOrParameterInspection extends BaseIn
|
||||
return;
|
||||
}
|
||||
if (method.hasModifierProperty(PsiModifier.ABSTRACT)) {
|
||||
registerModifierError(PsiModifier.FINAL, parameter, ProblemHighlightType.LIKE_UNUSED_SYMBOL, parameter);
|
||||
registerModifierError(PsiModifier.FINAL, parameter, parameter);
|
||||
}
|
||||
else if (!onlyWarnOnAbstractMethods) {
|
||||
check(parameter);
|
||||
@@ -152,7 +151,7 @@ public class UnnecessaryFinalOnLocalVariableOrParameterInspection extends BaseIn
|
||||
if (element instanceof PsiResourceVariable) {
|
||||
final PsiResourceVariable variable = (PsiResourceVariable)element;
|
||||
if (variable.hasModifierProperty(PsiModifier.FINAL)) {
|
||||
registerModifierError(PsiModifier.FINAL, variable, ProblemHighlightType.LIKE_UNUSED_SYMBOL, variable);
|
||||
registerModifierError(PsiModifier.FINAL, variable, variable);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -171,7 +170,7 @@ public class UnnecessaryFinalOnLocalVariableOrParameterInspection extends BaseIn
|
||||
continue;
|
||||
}
|
||||
if (parameter.getType() instanceof PsiDisjunctionType || !isNecessaryFinal(parameter, parameter.getDeclarationScope())) {
|
||||
registerModifierError(PsiModifier.FINAL, parameter, ProblemHighlightType.LIKE_UNUSED_SYMBOL, parameter);
|
||||
registerModifierError(PsiModifier.FINAL, parameter, parameter);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -196,7 +195,7 @@ public class UnnecessaryFinalOnLocalVariableOrParameterInspection extends BaseIn
|
||||
|
||||
private void check(PsiParameter parameter) {
|
||||
if (!isNecessaryFinal(parameter, parameter.getDeclarationScope())) {
|
||||
registerModifierError(PsiModifier.FINAL, parameter, ProblemHighlightType.LIKE_UNUSED_SYMBOL, parameter);
|
||||
registerModifierError(PsiModifier.FINAL, parameter, parameter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -2,7 +2,6 @@
|
||||
package com.siyeh.ig.style;
|
||||
|
||||
import com.intellij.codeInspection.CleanupLocalInspectionTool;
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
@@ -176,7 +175,7 @@ public class UnnecessaryModifierInspection extends BaseInspection implements Cle
|
||||
|
||||
private void registerError(@NotNull PsiKeyword modifier,
|
||||
@NotNull @PropertyKey(resourceBundle = InspectionGadgetsBundle.BUNDLE) String key) {
|
||||
registerError(modifier, ProblemHighlightType.LIKE_UNUSED_SYMBOL, InspectionGadgetsBundle.message(key), modifier.getText());
|
||||
registerError(modifier, InspectionGadgetsBundle.message(key), modifier.getText());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-3
@@ -17,7 +17,6 @@ package com.siyeh.ig.style;
|
||||
|
||||
import com.intellij.codeInspection.CleanupLocalInspectionTool;
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
@@ -89,7 +88,7 @@ public class UnnecessaryQualifierForThisInspection extends BaseInspection implem
|
||||
if (containingClass == null || !containingClass.equals(referent)) {
|
||||
return;
|
||||
}
|
||||
registerError(qualifier, ProblemHighlightType.LIKE_UNUSED_SYMBOL, thisExpression);
|
||||
registerError(qualifier, thisExpression);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -119,7 +118,7 @@ public class UnnecessaryQualifierForThisInspection extends BaseInspection implem
|
||||
assert copyQualifierExpression != null;
|
||||
PsiReplacementUtil.replaceExpression(copyQualifierExpression, PsiKeyword.SUPER);
|
||||
if (copy.resolve() == ((PsiReferenceExpression)parent).resolve()) {
|
||||
registerError(qualifier, ProblemHighlightType.LIKE_UNUSED_SYMBOL, expression);
|
||||
registerError(qualifier, expression);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-6
@@ -17,7 +17,6 @@ package com.siyeh.ig.style;
|
||||
|
||||
import com.intellij.codeInspection.CleanupLocalInspectionTool;
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.codeInspection.ui.SingleCheckboxOptionsPanel;
|
||||
import com.intellij.lang.LanguageUtil;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -121,7 +120,7 @@ public class UnnecessarySemicolonInspection extends BaseInspection implements Cl
|
||||
for (PsiElement sibling = element.getFirstChild(); sibling != null; sibling = PsiTreeUtil.skipWhitespacesAndCommentsForward(sibling)) {
|
||||
if (sibling instanceof PsiErrorElement) return;
|
||||
if (PsiUtil.isJavaToken(sibling, JavaTokenType.SEMICOLON)) {
|
||||
registerError(sibling, ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
registerError(sibling);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -138,12 +137,12 @@ public class UnnecessarySemicolonInspection extends BaseInspection implements Cl
|
||||
if (sibling instanceof PsiErrorElement) return;
|
||||
if (PsiUtil.isJavaToken(sibling, JavaTokenType.SEMICOLON)) {
|
||||
if (semicolonSeen) {
|
||||
registerError(sibling, ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
registerError(sibling);
|
||||
}
|
||||
else if (!ignoreAfterEnumConstants) {
|
||||
final PsiElement element = PsiTreeUtil.skipWhitespacesAndCommentsForward(sibling);
|
||||
if (PsiUtil.isJavaToken(element, JavaTokenType.RBRACE)) {
|
||||
registerError(sibling, ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
registerError(sibling);
|
||||
}
|
||||
}
|
||||
semicolonSeen = true;
|
||||
@@ -161,7 +160,7 @@ public class UnnecessarySemicolonInspection extends BaseInspection implements Cl
|
||||
if (semicolon == null) {
|
||||
return;
|
||||
}
|
||||
registerError(semicolon, ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
registerError(semicolon);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,7 +171,7 @@ public class UnnecessarySemicolonInspection extends BaseInspection implements Cl
|
||||
if (PsiUtil.isJavaToken(last, JavaTokenType.RPARENTH)) {
|
||||
final PsiElement prev = PsiTreeUtil.skipWhitespacesAndCommentsBackward(last);
|
||||
if (PsiUtil.isJavaToken(prev, JavaTokenType.SEMICOLON)) {
|
||||
registerError(prev, ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
registerError(prev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-3
@@ -17,9 +17,11 @@ package com.siyeh.ig.style;
|
||||
|
||||
import com.intellij.codeInspection.CleanupLocalInspectionTool;
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiKeyword;
|
||||
import com.intellij.psi.PsiMethodCallExpression;
|
||||
import com.intellij.psi.PsiReferenceExpression;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
import com.siyeh.ig.BaseInspection;
|
||||
import com.siyeh.ig.BaseInspectionVisitor;
|
||||
@@ -79,7 +81,7 @@ public class UnnecessarySuperConstructorInspection extends BaseInspection implem
|
||||
if (!call.getArgumentList().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
registerError(call, ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
registerError(call);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -17,7 +17,6 @@ package com.siyeh.ig.style;
|
||||
|
||||
import com.intellij.codeInspection.CleanupLocalInspectionTool;
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.codeInspection.ui.SingleCheckboxOptionsPanel;
|
||||
import com.intellij.java.analysis.JavaAnalysisBundle;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -138,7 +137,7 @@ public class UnnecessarySuperQualifierInspection extends BaseInspection implemen
|
||||
}
|
||||
}
|
||||
}
|
||||
registerError(expression, ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
registerError(expression);
|
||||
}
|
||||
|
||||
private static boolean hasUnnecessarySuperQualifier(PsiReferenceExpression referenceExpression) {
|
||||
|
||||
+5
-6
@@ -18,7 +18,6 @@ package com.siyeh.ig.style;
|
||||
import com.intellij.codeInsight.daemon.impl.analysis.HighlightUtil;
|
||||
import com.intellij.codeInspection.CleanupLocalInspectionTool;
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.codeInspection.ui.SingleCheckboxOptionsPanel;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
@@ -99,7 +98,7 @@ public class UnnecessaryThisInspection extends BaseInspection implements Cleanup
|
||||
if (parenthesizedThis.getParent() instanceof PsiNewExpression) {
|
||||
final PsiReference qualifier = expression.getQualifier();
|
||||
if (qualifier == null || qualifier.resolve() == PsiTreeUtil.getParentOfType(expression, PsiClass.class)) {
|
||||
registerError(expression, ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
registerError(expression);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -135,7 +134,7 @@ public class UnnecessaryThisInspection extends BaseInspection implements Cleanup
|
||||
}
|
||||
if (parent instanceof PsiCallExpression) {
|
||||
// method calls are always in error
|
||||
registerError(qualifierExpression, ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
registerError(qualifierExpression);
|
||||
return;
|
||||
}
|
||||
final PsiElement target = expression.resolve();
|
||||
@@ -149,7 +148,7 @@ public class UnnecessaryThisInspection extends BaseInspection implements Cleanup
|
||||
if (variable instanceof PsiField && HighlightUtil.isIllegalForwardReferenceToField(expression, (PsiField)variable, true) != null) {
|
||||
return;
|
||||
}
|
||||
registerError(thisExpression, ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
registerError(thisExpression);
|
||||
}
|
||||
else {
|
||||
final String qualifierName = qualifier.getReferenceName();
|
||||
@@ -169,7 +168,7 @@ public class UnnecessaryThisInspection extends BaseInspection implements Cleanup
|
||||
final PsiResolveHelper resolveHelper = psiFacade.getResolveHelper();
|
||||
while (parentClass != null) {
|
||||
if (qualifierName.equals(parentClass.getName())) {
|
||||
registerError(thisExpression, ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
registerError(thisExpression);
|
||||
}
|
||||
final PsiMethod[] methods = parentClass.findMethodsByName(methodName, true);
|
||||
for (PsiMethod method : methods) {
|
||||
@@ -196,7 +195,7 @@ public class UnnecessaryThisInspection extends BaseInspection implements Cleanup
|
||||
PsiClass parentClass = ClassUtils.getContainingClass(expression);
|
||||
while (parentClass != null) {
|
||||
if (qualifierName.equals(parentClass.getName())) {
|
||||
registerError(thisExpression, ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
registerError(thisExpression);
|
||||
}
|
||||
final PsiField field = parentClass.findFieldByName(referenceName, true);
|
||||
if (field != null) {
|
||||
|
||||
+1
-2
@@ -19,7 +19,6 @@ import com.intellij.codeInsight.Nullability;
|
||||
import com.intellij.codeInspection.CleanupLocalInspectionTool;
|
||||
import com.intellij.codeInspection.CommonQuickFixBundle;
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.codeInspection.dataFlow.NullabilityUtil;
|
||||
import com.intellij.codeInspection.ui.SingleCheckboxOptionsPanel;
|
||||
import com.intellij.java.analysis.JavaAnalysisBundle;
|
||||
@@ -121,7 +120,7 @@ public class UnnecessaryToStringCallInspection extends BaseInspection implements
|
||||
NullabilityUtil.getExpressionNullability(qualifier, true) != Nullability.NOT_NULL) {
|
||||
return;
|
||||
}
|
||||
registerError(referenceNameElement, ProblemHighlightType.LIKE_UNUSED_SYMBOL, qualifier.isPhysical() ? null : qualifier.getText());
|
||||
registerError(referenceNameElement, qualifier.isPhysical() ? null : qualifier.getText());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.siyeh.ig.threading;
|
||||
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.psi.PsiCodeBlock;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiKeyword;
|
||||
@@ -63,7 +62,7 @@ public class EmptySynchronizedStatementInspection extends BaseInspection {
|
||||
if (!ControlFlowUtils.isEmptyCodeBlock(body)) {
|
||||
return;
|
||||
}
|
||||
registerError(statement.getFirstChild(), ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
registerError(statement.getFirstChild());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -430,13 +430,15 @@
|
||||
level="WARNING" implementationClass="com.siyeh.ig.classlayout.FinalClassInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="FinalMethodInFinalClass" bundle="messages.InspectionGadgetsBundle"
|
||||
key="final.method.in.final.class.display.name" groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.declaration.redundancy" enabledByDefault="true" level="WARNING"
|
||||
groupKey="group.names.declaration.redundancy" enabledByDefault="true" level="WARNING"
|
||||
editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.siyeh.ig.classlayout.FinalMethodInFinalClassInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="FinalMethod" bundle="messages.InspectionGadgetsBundle" key="final.method.display.name"
|
||||
groupBundle="messages.InspectionsBundle" groupKey="group.names.class.structure" enabledByDefault="false"
|
||||
level="WARNING" implementationClass="com.siyeh.ig.classlayout.FinalMethodInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="FinalPrivateMethod" bundle="messages.InspectionGadgetsBundle" key="final.private.method.display.name"
|
||||
groupBundle="messages.InspectionsBundle" groupKey="group.names.class.structure" enabledByDefault="true" level="WARNING"
|
||||
editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.siyeh.ig.classlayout.FinalPrivateMethodInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="FinalStaticMethod" bundle="messages.InspectionGadgetsBundle" key="final.static.method.display.name"
|
||||
groupBundle="messages.InspectionsBundle" groupKey="group.names.class.structure" enabledByDefault="true" level="WARNING"
|
||||
@@ -602,6 +604,7 @@
|
||||
implementationClass="com.siyeh.ig.controlflow.ConditionalCanBePushedInsideExpressionInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" suppressId="ConfusingElseBranch" shortName="ConfusingElse" bundle="messages.InspectionGadgetsBundle"
|
||||
key="redundant.else.display.name" groupBundle="messages.InspectionsBundle" groupKey="group.names.control.flow.issues"
|
||||
editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
enabledByDefault="true" level="INFORMATION" implementationClass="com.siyeh.ig.controlflow.ConfusingElseInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="ConstantConditionalExpression" bundle="messages.InspectionGadgetsBundle"
|
||||
key="constant.conditional.expression.display.name" groupBundle="messages.InspectionsBundle"
|
||||
@@ -878,6 +881,7 @@
|
||||
implementationClass="com.siyeh.ig.errorhandling.CatchMayIgnoreExceptionInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="EmptyFinallyBlock" bundle="messages.InspectionGadgetsBundle" key="empty.finally.block.display.name"
|
||||
groupBundle="messages.InspectionsBundle" groupKey="group.names.error.handling" enabledByDefault="true" level="WARNING"
|
||||
editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.siyeh.ig.errorhandling.EmptyFinallyBlockInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="EmptyTryBlock" bundle="messages.InspectionGadgetsBundle" key="empty.try.block.display.name"
|
||||
groupBundle="messages.InspectionsBundle" groupKey="group.names.error.handling" enabledByDefault="true" level="WARNING"
|
||||
@@ -935,7 +939,7 @@
|
||||
implementationClass="com.siyeh.ig.errorhandling.UncheckedExceptionClassInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="UnnecessaryInitCause" bundle="messages.InspectionGadgetsBundle"
|
||||
key="unnecessary.initcause.display.name" groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.error.handling" enabledByDefault="true" level="WARNING"
|
||||
groupKey="group.names.error.handling" enabledByDefault="true" level="WARNING" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.siyeh.ig.errorhandling.UnnecessaryInitCauseInspection" cleanupTool="true"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="NewExceptionWithoutArguments" bundle="messages.InspectionGadgetsBundle" key="new.exception.without.arguments.display.name"
|
||||
groupBundle="messages.InspectionsBundle" groupKey="group.names.error.handling" enabledByDefault="false" level="WARNING"
|
||||
@@ -961,12 +965,14 @@
|
||||
<!--group.names.imports-->
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="JavaLangImport" bundle="messages.InspectionGadgetsBundle" key="java.lang.import.display.name"
|
||||
groupBundle="messages.InspectionsBundle" groupKey="group.names.imports" enabledByDefault="false" level="WARNING" cleanupTool="true"
|
||||
editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.siyeh.ig.imports.JavaLangImportInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="OnDemandImport" bundle="messages.InspectionGadgetsBundle" key="import.display.name"
|
||||
groupBundle="messages.InspectionsBundle" groupKey="group.names.imports" enabledByDefault="false" level="WARNING"
|
||||
implementationClass="com.siyeh.ig.imports.OnDemandImportInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="SamePackageImport" bundle="messages.InspectionGadgetsBundle" key="import.from.same.package.display.name"
|
||||
groupBundle="messages.InspectionsBundle" groupKey="group.names.imports" enabledByDefault="false" level="WARNING" cleanupTool="true"
|
||||
editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.siyeh.ig.imports.SamePackageImportInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="SingleClassImport" bundle="messages.InspectionGadgetsBundle" key="single.class.import.display.name"
|
||||
groupBundle="messages.InspectionsBundle" groupKey="group.names.imports" enabledByDefault="false" level="WARNING"
|
||||
@@ -1808,13 +1814,16 @@
|
||||
implementationClass="com.siyeh.ig.numeric.SuspiciousLiteralUnderscoreInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="UnaryPlus" bundle="messages.InspectionGadgetsBundle" key="unary.plus.display.name"
|
||||
groupBundle="messages.InspectionsBundle" groupKey="group.names.numeric.issues" enabledByDefault="true" level="WARNING"
|
||||
editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.siyeh.ig.numeric.UnaryPlusInspection"/>
|
||||
<localInspection groupPathKey="group.path.names.numeric" language="JAVA" shortName="UnnecessaryExplicitNumericCast" bundle="messages.InspectionGadgetsBundle"
|
||||
key="unnecessary.explicit.numeric.cast.display.name" groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.numeric.cast" enabledByDefault="false" level="WARNING"
|
||||
editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.siyeh.ig.numeric.UnnecessaryExplicitNumericCastInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="UnnecessaryUnaryMinus" bundle="messages.InspectionGadgetsBundle" key="unnecessary.unary.minus.display.name"
|
||||
groupBundle="messages.InspectionsBundle" groupKey="group.names.numeric.issues" enabledByDefault="true" level="WARNING"
|
||||
editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.siyeh.ig.numeric.UnnecessaryUnaryMinusInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="UnpredictableBigDecimalConstructorCall" bundle="messages.InspectionGadgetsBundle"
|
||||
key="unpredictable.big.decimal.constructor.call.display.name" groupBundle="messages.InspectionsBundle"
|
||||
@@ -2041,6 +2050,7 @@
|
||||
<!--group.names.declaration.redundancy-->
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="UnusedLabel" bundle="messages.InspectionGadgetsBundle" key="unused.label.display.name"
|
||||
groupBundle="messages.InspectionsBundle" groupKey="group.names.declaration.redundancy" enabledByDefault="true"
|
||||
editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
level="WARNING" implementationClass="com.siyeh.ig.redundancy.UnusedLabelInspection"/>
|
||||
|
||||
<!--group.names.resource.management.issues-->
|
||||
@@ -2229,7 +2239,7 @@
|
||||
implementationClass="com.siyeh.ig.serialization.SerializableRecordContainsIgnoredMembersInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="TransientFieldInNonSerializableClass" bundle="messages.InspectionGadgetsBundle"
|
||||
key="transient.field.in.non.serializable.class.display.name" groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.serialization.issues" enabledByDefault="false" level="WARNING"
|
||||
groupKey="group.names.serialization.issues" enabledByDefault="false" level="WARNING" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.siyeh.ig.serialization.TransientFieldInNonSerializableClassInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="TransientFieldNotInitialized" bundle="messages.InspectionGadgetsBundle"
|
||||
key="transient.field.not.initialized.display.name" groupBundle="messages.InspectionsBundle"
|
||||
@@ -2305,7 +2315,7 @@
|
||||
implementationClass="com.siyeh.ig.style.MultipleVariablesInDeclarationInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="UnnecessaryConstantArrayCreationExpression" bundle="messages.InspectionGadgetsBundle"
|
||||
key="unnecessary.constant.array.creation.expression.display.name" groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.code.style.issues" enabledByDefault="false" level="WARNING" cleanupTool="true"
|
||||
groupKey="group.names.code.style.issues" enabledByDefault="false" level="WARNING" cleanupTool="true" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.siyeh.ig.style.UnnecessaryConstantArrayCreationExpressionInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="NestedMethodCall" bundle="messages.InspectionGadgetsBundle" key="nested.method.call.display.name"
|
||||
groupBundle="messages.InspectionsBundle" groupKey="group.names.code.style.issues" enabledByDefault="false"
|
||||
@@ -2316,18 +2326,18 @@
|
||||
implementationClass="com.siyeh.ig.style.OptionalContainsCollectionInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="RedundantFieldInitialization" bundle="messages.InspectionGadgetsBundle"
|
||||
key="redundant.field.initialization.display.name" groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.code.style.issues" enabledByDefault="false" level="WARNING" cleanupTool="true"
|
||||
groupKey="group.names.code.style.issues" enabledByDefault="false" level="WARNING" cleanupTool="true" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.siyeh.ig.style.RedundantFieldInitializationInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" suppressId="RedundantInterfaceDeclaration" shortName="RedundantImplements" bundle="messages.InspectionGadgetsBundle"
|
||||
key="redundant.implements.display.name" groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.declaration.redundancy" enabledByDefault="false" level="WARNING" cleanupTool="true"
|
||||
groupKey="group.names.declaration.redundancy" enabledByDefault="false" level="WARNING" cleanupTool="true" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.siyeh.ig.style.RedundantImplementsInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" suppressId="ReturnOfThis" shortName="ReturnThis" bundle="messages.InspectionGadgetsBundle"
|
||||
key="return.this.display.name" groupBundle="messages.InspectionsBundle" groupKey="group.names.code.style.issues"
|
||||
enabledByDefault="false" level="WARNING" implementationClass="com.siyeh.ig.style.ReturnThisInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="SimplifiableAnnotation" bundle="messages.InspectionGadgetsBundle"
|
||||
key="simplifiable.annotation.display.name" groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.code.style.issues" enabledByDefault="false" level="WARNING"
|
||||
groupKey="group.names.code.style.issues" enabledByDefault="false" level="WARNING" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.siyeh.ig.style.SimplifiableAnnotationInspection" cleanupTool="true"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="SimplifiableEqualsExpression" bundle="messages.InspectionGadgetsBundle"
|
||||
key="simplifiable.equals.expression.display.name" groupBundle="messages.InspectionsBundle"
|
||||
@@ -2340,10 +2350,12 @@
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="UnnecessarilyQualifiedInnerClassAccess" bundle="messages.InspectionGadgetsBundle"
|
||||
key="unnecessarily.qualified.inner.class.access.display.name" groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.code.style.issues" enabledByDefault="true" level="INFORMATION" cleanupTool="true"
|
||||
editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.siyeh.ig.style.UnnecessarilyQualifiedInnerClassAccessInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="UnnecessarilyQualifiedStaticUsage" bundle="messages.InspectionGadgetsBundle"
|
||||
key="unnecessarily.qualified.static.usage.display.name" groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.code.style.issues" enabledByDefault="false" level="WARNING" cleanupTool="true"
|
||||
editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.siyeh.ig.style.UnnecessarilyQualifiedStaticUsageInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" suppressId="UnnecessaryCodeBlock" shortName="UnnecessaryBlockStatement" bundle="messages.InspectionGadgetsBundle"
|
||||
key="unnecessary.code.block.display.name" groupBundle="messages.InspectionsBundle"
|
||||
@@ -2351,23 +2363,23 @@
|
||||
implementationClass="com.siyeh.ig.style.UnnecessaryBlockStatementInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="UnnecessaryCallToStringValueOf" bundle="messages.InspectionGadgetsBundle"
|
||||
key="unnecessary.conversion.to.string.display.name" groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.code.style.issues" enabledByDefault="true" level="WARNING" cleanupTool="true"
|
||||
groupKey="group.names.code.style.issues" enabledByDefault="true" level="WARNING" cleanupTool="true" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.siyeh.ig.style.UnnecessaryCallToStringValueOfInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="UnnecessaryToStringCall" bundle="messages.InspectionGadgetsBundle"
|
||||
key="unnecessary.tostring.call.display.name" groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.code.style.issues" enabledByDefault="true" level="WARNING" cleanupTool="true"
|
||||
groupKey="group.names.code.style.issues" enabledByDefault="true" level="WARNING" cleanupTool="true" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.siyeh.ig.style.UnnecessaryToStringCallInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" suppressId="RedundantNoArgConstructor" shortName="UnnecessaryConstructor" bundle="messages.InspectionGadgetsBundle"
|
||||
key="unnecessary.constructor.display.name" groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.code.style.issues" enabledByDefault="false" level="WARNING"
|
||||
groupKey="group.names.code.style.issues" enabledByDefault="false" level="WARNING" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.siyeh.ig.style.UnnecessaryConstructorInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="UnnecessaryFinalOnLocalVariableOrParameter" bundle="messages.InspectionGadgetsBundle"
|
||||
key="unnecessary.final.on.local.variable.or.parameter.display.name" groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.code.style.issues" enabledByDefault="false" level="WARNING" cleanupTool="true"
|
||||
groupKey="group.names.code.style.issues" enabledByDefault="false" level="WARNING" cleanupTool="true" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.siyeh.ig.style.UnnecessaryFinalOnLocalVariableOrParameterInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="UnnecessaryFullyQualifiedName" bundle="messages.InspectionGadgetsBundle"
|
||||
key="unnecessary.fully.qualified.name.display.name" groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.code.style.issues" enabledByDefault="true" level="INFORMATION" cleanupTool="true"
|
||||
groupKey="group.names.code.style.issues" enabledByDefault="true" level="INFORMATION" cleanupTool="true" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.siyeh.ig.style.UnnecessaryFullyQualifiedNameInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="UnnecessaryParentheses" bundle="messages.InspectionGadgetsBundle"
|
||||
key="unnecessary.parentheses.display.name" groupBundle="messages.InspectionsBundle"
|
||||
@@ -2375,22 +2387,22 @@
|
||||
implementationClass="com.siyeh.ig.style.UnnecessaryParenthesesInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="UnnecessarilyQualifiedStaticallyImportedElement" bundle="messages.InspectionGadgetsBundle"
|
||||
key="unnecessarily.qualified.statically.imported.element.display.name" groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.code.style.issues" enabledByDefault="false" level="WARNING" cleanupTool="true"
|
||||
groupKey="group.names.code.style.issues" enabledByDefault="false" level="WARNING" cleanupTool="true" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.siyeh.ig.style.UnnecessarilyQualifiedStaticallyImportedElementInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="UnnecessaryQualifierForThis" bundle="messages.InspectionGadgetsBundle"
|
||||
key="unnecessary.qualifier.for.this.display.name" groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.code.style.issues" enabledByDefault="false" level="WARNING" cleanupTool="true"
|
||||
groupKey="group.names.code.style.issues" enabledByDefault="false" level="WARNING" cleanupTool="true" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.siyeh.ig.style.UnnecessaryQualifierForThisInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="UnnecessarySemicolon" bundle="messages.InspectionGadgetsBundle" key="unnecessary.semicolon.display.name"
|
||||
groupBundle="messages.InspectionsBundle" groupKey="group.names.code.style.issues" enabledByDefault="true" cleanupTool="true"
|
||||
groupBundle="messages.InspectionsBundle" groupKey="group.names.code.style.issues" enabledByDefault="true" cleanupTool="true" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
level="WARNING" implementationClass="com.siyeh.ig.style.UnnecessarySemicolonInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" suppressId="UnnecessaryCallToSuper" shortName="UnnecessarySuperConstructor" bundle="messages.InspectionGadgetsBundle"
|
||||
key="unnecessary.super.constructor.display.name" groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.code.style.issues" enabledByDefault="false" level="WARNING" cleanupTool="true"
|
||||
groupKey="group.names.code.style.issues" enabledByDefault="false" level="WARNING" cleanupTool="true" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.siyeh.ig.style.UnnecessarySuperConstructorInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="UnnecessarySuperQualifier" bundle="messages.InspectionGadgetsBundle"
|
||||
key="unnecessary.super.qualifier.display.name" groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.code.style.issues" enabledByDefault="false" level="WARNING" cleanupTool="true"
|
||||
groupKey="group.names.code.style.issues" enabledByDefault="false" level="WARNING" cleanupTool="true" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.siyeh.ig.style.UnnecessarySuperQualifierInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="UnnecessaryThis" bundle="messages.InspectionGadgetsBundle" key="unnecessary.this.display.name"
|
||||
groupBundle="messages.InspectionsBundle" groupKey="group.names.code.style.issues" enabledByDefault="false" cleanupTool="true"
|
||||
@@ -2471,7 +2483,7 @@
|
||||
implementationClass="com.siyeh.ig.style.ArrayCanBeReplacedWithEnumValuesInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="UnnecessaryModifier" bundle="messages.InspectionGadgetsBundle"
|
||||
key="unnecessary.modifier.display.name" groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.code.style.issues" enabledByDefault="true" level="WARNING" cleanupTool="true"
|
||||
groupKey="group.names.code.style.issues" enabledByDefault="true" level="WARNING" cleanupTool="true" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.siyeh.ig.style.UnnecessaryModifierInspection"/>
|
||||
|
||||
<!--group.names.threading.issues-->
|
||||
@@ -2513,7 +2525,7 @@
|
||||
level="WARNING" implementationClass="com.siyeh.ig.threading.DoubleCheckedLockingInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="EmptySynchronizedStatement" bundle="messages.InspectionGadgetsBundle"
|
||||
key="empty.synchronized.statement.display.name" groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.threading.issues" enabledByDefault="true" level="WARNING"
|
||||
groupKey="group.names.threading.issues" enabledByDefault="true" level="WARNING" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.siyeh.ig.threading.EmptySynchronizedStatementInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" suppressId="ClassExplicitlyExtendsThread" shortName="ExtendsThread" bundle="messages.InspectionGadgetsBundle"
|
||||
key="extends.thread.display.name" groupBundle="messages.InspectionsBundle" groupKey="group.names.threading.issues"
|
||||
@@ -2667,7 +2679,7 @@
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="RedundantCompareCall"
|
||||
groupBundle="messages.InspectionsBundle" groupKey="group.names.verbose.or.redundant.code.constructs"
|
||||
enabledByDefault="true" level="WARNING"
|
||||
key="inspection.redundant.compare.call.display.name" bundle="messages.InspectionGadgetsBundle"
|
||||
key="inspection.redundant.compare.call.display.name" bundle="messages.InspectionGadgetsBundle" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.intellij.codeInspection.RedundantCompareCallInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="RedundantClassCall" bundle="messages.InspectionGadgetsBundle"
|
||||
key="inspection.redundant.class.call.display.name" groupBundle="messages.InspectionsBundle" groupKey="group.names.verbose.or.redundant.code.constructs"
|
||||
@@ -2678,10 +2690,10 @@
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="UnnecessaryStringEscape" bundle="messages.InspectionGadgetsBundle"
|
||||
key="unnecessary.string.escape.display.name" groupBundle="messages.InspectionsBundle" groupKey="group.names.verbose.or.redundant.code.constructs"
|
||||
enabledByDefault="true" level="WARNING" cleanupTool="true" implementationClass="com.siyeh.ig.redundancy.UnnecessaryStringEscapeInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="StringOperationCanBeSimplified" bundle="messages.InspectionGadgetsBundle"
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="StringOperationCanBeSimplified" bundle="messages.InspectionGadgetsBundle" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
key="inspection.redundant.string.operation.display.name" groupBundle="messages.InspectionsBundle" groupKey="group.names.verbose.or.redundant.code.constructs"
|
||||
enabledByDefault="true" level="WARNING" cleanupTool="true" implementationClass="com.siyeh.ig.redundancy.RedundantStringOperationInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="ReplaceOnLiteralHasNoEffect" bundle="messages.InspectionGadgetsBundle"
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="ReplaceOnLiteralHasNoEffect" bundle="messages.InspectionGadgetsBundle" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
key="inspection.replace.on.literal.display.name" groupBundle="messages.InspectionsBundle" groupKey="group.names.verbose.or.redundant.code.constructs"
|
||||
enabledByDefault="true" level="WARNING" implementationClass="com.siyeh.ig.redundancy.ReplaceOnLiteralHasNoEffectInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="StringBufferReplaceableByString" bundle="messages.InspectionGadgetsBundle"
|
||||
@@ -2690,24 +2702,30 @@
|
||||
implementationClass="com.siyeh.ig.style.StringBufferReplaceableByStringInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="UnnecessaryBreak" bundle="messages.InspectionGadgetsBundle" key="unnecessary.break.display.name"
|
||||
groupBundle="messages.InspectionsBundle" groupKey="group.names.verbose.or.redundant.code.constructs" enabledByDefault="true"
|
||||
editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
level="WARNING" implementationClass="com.siyeh.ig.controlflow.UnnecessaryBreakInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="UnnecessaryContinue" bundle="messages.InspectionGadgetsBundle" key="unnecessary.continue.display.name"
|
||||
groupBundle="messages.InspectionsBundle" groupKey="group.names.verbose.or.redundant.code.constructs" enabledByDefault="true"
|
||||
editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
level="WARNING" implementationClass="com.siyeh.ig.controlflow.UnnecessaryContinueInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="UnnecessaryDefault" bundle="messages.InspectionGadgetsBundle" key="unnecessary.default.display.name"
|
||||
groupBundle="messages.InspectionsBundle" groupKey="group.names.verbose.or.redundant.code.constructs" enabledByDefault="true"
|
||||
editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
level="WARNING" implementationClass="com.siyeh.ig.controlflow.UnnecessaryDefaultInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="UnnecessaryLabelOnBreakStatement" bundle="messages.InspectionGadgetsBundle"
|
||||
key="unnecessary.label.on.break.statement.display.name" groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.verbose.or.redundant.code.constructs" enabledByDefault="true" level="WARNING"
|
||||
editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.siyeh.ig.controlflow.UnnecessaryLabelOnBreakStatementInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="UnnecessaryLabelOnContinueStatement" bundle="messages.InspectionGadgetsBundle"
|
||||
key="unnecessary.label.on.continue.statement.display.name" groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.verbose.or.redundant.code.constructs" enabledByDefault="true" level="WARNING"
|
||||
editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.siyeh.ig.controlflow.UnnecessaryLabelOnContinueStatementInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" suppressId="UnnecessaryReturnStatement" shortName="UnnecessaryReturn" bundle="messages.InspectionGadgetsBundle"
|
||||
key="unnecessary.return.display.name" groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.verbose.or.redundant.code.constructs" enabledByDefault="true" level="WARNING"
|
||||
editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.siyeh.ig.controlflow.UnnecessaryReturnInspection"/>
|
||||
|
||||
<!--group.names.visibility.issues-->
|
||||
@@ -2767,7 +2785,7 @@
|
||||
level="WARNING" implementationClass="com.siyeh.ig.visibility.LambdaParameterHidingMemberVariableInspection"/>
|
||||
<localInspection groupPathKey="group.path.names.java.language.level.specific.issues.and.migration.aids" language="JAVA" shortName="RedundantExplicitVariableType" enabledByDefault="true" level="INFORMATION"
|
||||
bundle="messages.InspectionGadgetsBundle" key="redundant.explicit.var.type.display.name"
|
||||
groupBundle="messages.InspectionsBundle" groupKey="group.names.language.level.specific.issues.and.migration.aids10"
|
||||
groupBundle="messages.InspectionsBundle" groupKey="group.names.language.level.specific.issues.and.migration.aids10" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"
|
||||
implementationClass="com.intellij.codeInspection.RedundantExplicitVariableTypeInspection"/>
|
||||
<localInspection groupPathKey="group.path.names.java.language.level.specific.issues.and.migration.aids" language="JAVA" shortName="PatternVariableCanBeUsed" enabledByDefault="true" level="WARNING"
|
||||
bundle="messages.InspectionGadgetsBundle" key="inspection.pattern.variable.can.be.used.display.name"
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInspection;
|
||||
|
||||
import com.intellij.java.JavaBundle;
|
||||
@@ -112,7 +112,7 @@ public class RedundantComparatorComparingInspection extends AbstractBaseJavaLoca
|
||||
holder
|
||||
.registerProblem(comparingCall.getMethodExpression(),
|
||||
JavaBundle.message("inspection.simplifiable.comparator.comparing.message", name),
|
||||
ProblemHighlightType.LIKE_UNUSED_SYMBOL, new DeleteComparingCallFix(name, targetMethod));
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING, new DeleteComparingCallFix(name, targetMethod));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInspection;
|
||||
|
||||
import com.intellij.codeInspection.dataFlow.DfaPsiUtil;
|
||||
@@ -43,7 +43,7 @@ public class RedundantCompareCallInspection extends AbstractBaseJavaLocalInspect
|
||||
} else if (!ExpressionUtils.isZero(binOp.getROperand())) {
|
||||
return;
|
||||
}
|
||||
holder.registerProblem(call, InspectionGadgetsBundle.message("redundant.call.problem.descriptor"), ProblemHighlightType.LIKE_UNUSED_SYMBOL,
|
||||
holder.registerProblem(call, InspectionGadgetsBundle.message("redundant.call.problem.descriptor"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
|
||||
new TextRange(0, call.getArgumentList().getStartOffsetInParent()),
|
||||
new InlineCompareCallFix(type));
|
||||
}
|
||||
|
||||
-1
@@ -62,7 +62,6 @@ public class RedundantExplicitVariableTypeInspection extends AbstractBaseJavaLoc
|
||||
if (variable.getType().equals(getNormalizedType(copyVariable))) {
|
||||
holder.registerProblem(element2Highlight,
|
||||
InspectionGadgetsBundle.message("inspection.redundant.explicit.variable.type.description"),
|
||||
ProblemHighlightType.LIKE_UNUSED_SYMBOL,
|
||||
new ReplaceWithVarFix());
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -123,7 +123,7 @@ public class TrivialFunctionalExpressionUsageInspection extends AbstractBaseJava
|
||||
if (method == interfaceMethod || interfaceMethod != null && MethodSignatureUtil.isSuperMethod(interfaceMethod, method)) {
|
||||
holder.registerProblem(referenceNameElement,
|
||||
InspectionGadgetsBundle.message("inspection.trivial.functional.expression.usage.description"),
|
||||
ProblemHighlightType.LIKE_UNUSED_SYMBOL, fix);
|
||||
fix);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
+1
-2
@@ -3,7 +3,6 @@ package com.siyeh.ig.errorhandling;
|
||||
|
||||
import com.intellij.codeInspection.CleanupLocalInspectionTool;
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.psi.*;
|
||||
@@ -141,7 +140,7 @@ public class UnnecessaryInitCauseInspection extends BaseInspection implements Cl
|
||||
if (nameToken == null) {
|
||||
return;
|
||||
}
|
||||
registerError(nameToken, ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
registerError(nameToken);
|
||||
}
|
||||
|
||||
private static boolean canExpressionBeMovedBackwards(final PsiExpression cause, final PsiExpression newLocation) {
|
||||
|
||||
+11
-11
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.siyeh.ig.redundancy;
|
||||
|
||||
import com.intellij.codeInsight.BlockUtils;
|
||||
@@ -198,7 +198,7 @@ public class RedundantStringOperationInspection extends AbstractBaseJavaLocalIns
|
||||
InspectionGadgetsBundle.message("inspection.redundant.string.option.do.not.report.string.constructors"), true)};
|
||||
return myManager.createProblemDescriptor(expression, range,
|
||||
InspectionGadgetsBundle.message("inspection.redundant.string.constructor.message"),
|
||||
ProblemHighlightType.LIKE_UNUSED_SYMBOL, myIsOnTheFly, fixes);
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING, myIsOnTheFly, fixes);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -270,7 +270,7 @@ public class RedundantStringOperationInspection extends AbstractBaseJavaLocalIns
|
||||
return myManager.createProblemDescriptor(anchor, (TextRange)null,
|
||||
InspectionGadgetsBundle.message("inspection.x.call.can.be.replaced.with.y",
|
||||
nameMethod, EQUALS_IGNORE_CASE),
|
||||
ProblemHighlightType.LIKE_UNUSED_SYMBOL, myIsOnTheFly,
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING, myIsOnTheFly,
|
||||
new RemoveRedundantChangeCaseFix(nameMethod, type));
|
||||
}
|
||||
|
||||
@@ -315,7 +315,7 @@ public class RedundantStringOperationInspection extends AbstractBaseJavaLocalIns
|
||||
}
|
||||
return myManager.createProblemDescriptor(anchor, (TextRange)null,
|
||||
InspectionGadgetsBundle.message("inspection.redundant.string.call.message"),
|
||||
ProblemHighlightType.LIKE_UNUSED_SYMBOL, myIsOnTheFly,
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING, myIsOnTheFly,
|
||||
new RemoveRedundantSubstringFix("startsWith"));
|
||||
}
|
||||
}
|
||||
@@ -330,7 +330,7 @@ public class RedundantStringOperationInspection extends AbstractBaseJavaLocalIns
|
||||
if (anchor != null) {
|
||||
return myManager.createProblemDescriptor(anchor, (TextRange)null,
|
||||
InspectionGadgetsBundle.message("inspection.redundant.string.call.message"),
|
||||
ProblemHighlightType.LIKE_UNUSED_SYMBOL, myIsOnTheFly,
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING, myIsOnTheFly,
|
||||
new RemoveRedundantSubstringFix("endsWith"));
|
||||
}
|
||||
}
|
||||
@@ -416,7 +416,7 @@ public class RedundantStringOperationInspection extends AbstractBaseJavaLocalIns
|
||||
PsiElement anchor = qualifierCall.getMethodExpression().getReferenceNameElement();
|
||||
if (anchor == null) return null;
|
||||
String message = InspectionGadgetsBundle.message("inspection.x.call.can.be.replaced.with.y", "strip", "isBlank");
|
||||
return myManager.createProblemDescriptor(anchor, (TextRange)null, message, ProblemHighlightType.LIKE_UNUSED_SYMBOL, myIsOnTheFly,
|
||||
return myManager.createProblemDescriptor(anchor, (TextRange)null, message, ProblemHighlightType.GENERIC_ERROR_OR_WARNING, myIsOnTheFly,
|
||||
new StripIsEmptyToIsBlankFix());
|
||||
}
|
||||
|
||||
@@ -479,7 +479,7 @@ public class RedundantStringOperationInspection extends AbstractBaseJavaLocalIns
|
||||
InspectionGadgetsBundle.message(key),
|
||||
myIsOnTheFly,
|
||||
new LocalQuickFix[]{fix},
|
||||
ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -518,7 +518,7 @@ public class RedundantStringOperationInspection extends AbstractBaseJavaLocalIns
|
||||
final String message = InspectionGadgetsBundle.message("inspection.redundant.string.length.argument.message");
|
||||
return myManager.createProblemDescriptor(args[1],
|
||||
message,
|
||||
fix, ProblemHighlightType.LIKE_UNUSED_SYMBOL, myIsOnTheFly);
|
||||
fix, ProblemHighlightType.GENERIC_ERROR_OR_WARNING, myIsOnTheFly);
|
||||
}
|
||||
|
||||
boolean betterWithCharAt = isBetterWithCharAt(call);
|
||||
@@ -547,7 +547,7 @@ public class RedundantStringOperationInspection extends AbstractBaseJavaLocalIns
|
||||
InspectionGadgetsBundle.message("inspection.redundant.string.call.message"),
|
||||
new RemoveRedundantStringCallFix(
|
||||
nameElement.getText(), FixType.REPLACE_WITH_ARGUMENTS),
|
||||
ProblemHighlightType.LIKE_UNUSED_SYMBOL, myIsOnTheFly);
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING, myIsOnTheFly);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -600,7 +600,7 @@ public class RedundantStringOperationInspection extends AbstractBaseJavaLocalIns
|
||||
}
|
||||
String name = call.getMethodExpression().getReferenceName();
|
||||
return myManager.createProblemDescriptor(anchor, (TextRange)null, InspectionGadgetsBundle.message(key),
|
||||
ProblemHighlightType.LIKE_UNUSED_SYMBOL, myIsOnTheFly,
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING, myIsOnTheFly,
|
||||
new RemoveRedundantStringCallFix(name, FixType.REPLACE_WITH_QUALIFIER));
|
||||
}
|
||||
|
||||
@@ -611,7 +611,7 @@ public class RedundantStringOperationInspection extends AbstractBaseJavaLocalIns
|
||||
return myManager.createProblemDescriptor(charArrayCreationArgument.newExpression,
|
||||
new TextRange(0, charArrayCreationArgument.arrayInitializer.getStartOffsetInParent()),
|
||||
InspectionGadgetsBundle.message("inspection.redundant.string.constructor.message"),
|
||||
ProblemHighlightType.LIKE_UNUSED_SYMBOL,
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
|
||||
myIsOnTheFly,
|
||||
new UnwrapArrayInitializerFix(charArrayCreationArgument.initializer.getText()));
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.siyeh.ig.redundancy;
|
||||
|
||||
import com.intellij.codeInspection.*;
|
||||
@@ -42,7 +42,7 @@ public class ReplaceOnLiteralHasNoEffectInspection extends AbstractBaseJavaLocal
|
||||
if (!isRedundant(str, pattern, "replace".equals(name))) return;
|
||||
PsiElement refName = Objects.requireNonNull(call.getMethodExpression().getReferenceNameElement());
|
||||
holder.registerProblem(call, InspectionGadgetsBundle.message("inspection.replace.on.literal.display.name"),
|
||||
ProblemHighlightType.LIKE_UNUSED_SYMBOL,
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
|
||||
TextRange.create(refName.getTextRangeInParent().getStartOffset(), call.getTextLength()),
|
||||
ExpressionUtils.isVoidContext(call) ? null : new ReplaceWithQualifierFix());
|
||||
}
|
||||
|
||||
+1
-1
@@ -277,7 +277,7 @@ public class UnnecessaryFullyQualifiedNameInspection extends BaseInspection impl
|
||||
elementToHighlight = aReference;
|
||||
}
|
||||
else {
|
||||
highlightType = ProblemHighlightType.LIKE_UNUSED_SYMBOL;
|
||||
highlightType = ProblemHighlightType.GENERIC_ERROR_OR_WARNING;
|
||||
}
|
||||
|
||||
final boolean inSameFile = aClass.getContainingFile() == containingFile ||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
enabledByDefault="true" level="WARNING" groupKey="group.name.javafx"
|
||||
key="inspection.java.fx.unresolved.fx.id.reference.display.name"/>
|
||||
<localInspection language="XML" shortName="JavaFxUnusedImports" implementationClass="org.jetbrains.plugins.javaFX.fxml.codeInsight.inspections.JavaFxUnusedImportsInspection"
|
||||
enabledByDefault="true" level="WARNING" groupKey="group.name.javafx" key="inspection.java.fx.unused.imports.display.name"/>
|
||||
enabledByDefault="true" level="WARNING" groupKey="group.name.javafx" key="inspection.java.fx.unused.imports.display.name" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES"/>
|
||||
<localInspection language="XML" shortName="JavaFxRedundantPropertyValue" implementationClass="org.jetbrains.plugins.javaFX.fxml.codeInsight.inspections.JavaFxRedundantPropertyValueInspection"
|
||||
enabledByDefault="true" level="WARNING" groupKey="group.name.javafx"
|
||||
key="inspection.java.fx.redundant.property.value.display.name"/>
|
||||
|
||||
+3
-17
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.plugins.javaFX.fxml.codeInsight.inspections;
|
||||
|
||||
import com.intellij.codeInsight.daemon.QuickFixBundle;
|
||||
@@ -74,12 +60,12 @@ public class JavaFxUnusedImportsInspection extends XmlSuppressableInspectionTool
|
||||
if (target.endsWith(".*")) {
|
||||
if (!usedNames.contains(StringUtil.trimEnd(target, ".*"))) {
|
||||
problems.add(inspectionManager
|
||||
.createProblemDescriptor(instruction, JavaFXBundle.message("inspection.javafx.unused.imports.problem"), new JavaFxOptimizeImportsFix(), ProblemHighlightType.LIKE_UNUSED_SYMBOL, isOnTheFly));
|
||||
.createProblemDescriptor(instruction, JavaFXBundle.message("inspection.javafx.unused.imports.problem"), new JavaFxOptimizeImportsFix(), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, isOnTheFly));
|
||||
}
|
||||
}
|
||||
else if (!usedNames.contains(target) || targetProcessingInstructions.containsKey(StringUtil.getPackageName(target) + ".*")) {
|
||||
problems.add(inspectionManager
|
||||
.createProblemDescriptor(instruction, JavaFXBundle.message("inspection.javafx.unused.imports.problem"), new JavaFxOptimizeImportsFix(), ProblemHighlightType.LIKE_UNUSED_SYMBOL, isOnTheFly));
|
||||
.createProblemDescriptor(instruction, JavaFXBundle.message("inspection.javafx.unused.imports.problem"), new JavaFxOptimizeImportsFix(), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, isOnTheFly));
|
||||
}
|
||||
}
|
||||
return problems.isEmpty() ? null : problems.toArray(ProblemDescriptor.EMPTY_ARRAY);
|
||||
|
||||
Reference in New Issue
Block a user