localize "Inspections" hardcoded literals

GitOrigin-RevId: 274c389075024728618e18c2a79804f31895c7c2
This commit is contained in:
Dmitry.Krasilschikov
2020-02-04 16:30:53 +02:00
committed by intellij-monorepo-bot
parent f95ca036b8
commit 197f0bd546
35 changed files with 156 additions and 77 deletions

View File

@@ -118,6 +118,6 @@ public class AnnotateMethodFix implements LocalQuickFix {
}
});
}
}, "Searching for Overriding Methods", true, method.getProject());
}, InspectionsBundle.message("searching.for.overriding.methods"), true, method.getProject());
}
}

View File

@@ -60,7 +60,7 @@ public class AnonymousCanBeLambdaInspection extends AbstractBaseJavaLocalInspect
@Nullable
@Override
public JComponent createOptionsPanel() {
return new SingleCheckboxOptionsPanel("Report when interface is not annotated with @FunctionalInterface", this, "reportNotAnnotatedInterfaces");
return new SingleCheckboxOptionsPanel(InspectionsBundle.message("report.when.interface.is.not.annotated.with.functional.interface"), this, "reportNotAnnotatedInterfaces");
}
@NotNull
@@ -83,7 +83,7 @@ public class AnonymousCanBeLambdaInspection extends AbstractBaseJavaLocalInspect
type = ProblemHighlightType.INFORMATION;
}
}
holder.registerProblem(parent, "Anonymous #ref #loc can be replaced with lambda",
holder.registerProblem(parent, InspectionsBundle.message("anonymous.ref.loc.can.be.replaced.with.lambda"),
type, rangeInElement, new ReplaceWithLambdaFix());
}
}
@@ -381,7 +381,7 @@ public class AnonymousCanBeLambdaInspection extends AbstractBaseJavaLocalInspect
@NotNull
@Override
public String getFamilyName() {
return "Replace with lambda";
return InspectionsBundle.message("replace.with.lambda");
}
@Override

View File

@@ -58,7 +58,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(), "Anonymous #ref #loc can be replaced with "+alternative.myReplacementMessage,
holder.registerProblem(aClass.getParent(),
InspectionsBundle.message("anonymous.ref.loc.can.be.replaced.with.0", alternative.myReplacementMessage),
ProblemHighlightType.LIKE_UNUSED_SYMBOL, rangeInElement, new ReplaceWithLambdaAlternativeFix(alternative));
}
}
@@ -88,14 +89,14 @@ public class AnonymousHasLambdaAlternativeInspection extends AbstractBaseJavaLoc
@NotNull
@Override
public String getName() {
return "Replace with "+myAlternative.myReplacementMessage;
return InspectionsBundle.message("replace.with.0", myAlternative.myReplacementMessage);
}
@Nls
@NotNull
@Override
public String getFamilyName() {
return "Replace anonymous class with lambda alternative";
return InspectionsBundle.message("replace.anonymous.class.with.lambda.alternative");
}
@Override

View File

@@ -77,11 +77,11 @@ public class BlockMarkerCommentsInspection extends AbstractBaseJavaLocalInspecti
return;
}
if (MARKER_PATTERN.accepts(element)) {
holder.registerProblem(element, "Redundant block marker", new LocalQuickFix() {
holder.registerProblem(element, InspectionsBundle.message("redundant.block.marker"), new LocalQuickFix() {
@NotNull
@Override
public String getFamilyName() {
return "Remove block marker comments";
return InspectionsBundle.message("remove.block.marker.comments");
}
@Override

View File

@@ -38,7 +38,7 @@ public class DeprecatedIsStillUsedInspection extends LocalInspectionTool {
PsiSearchHelper searchHelper = PsiSearchHelper.getInstance(member.getProject());
String name = member.getName();
if (name != null && hasUsages(member, name, searchHelper, member.getResolveScope())) {
holder.registerProblem(identifier, "Deprecated member '" + name + "' is still used");
holder.registerProblem(identifier, InspectionsBundle.message("deprecated.member.0.is.still.used", name));
}
}

View File

@@ -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, "Explicit type argument #ref #loc can be replaced with <>", ProblemHighlightType.LIKE_UNUSED_SYMBOL, range, new ReplaceWithDiamondFix());
holder.registerProblem(parameterList, InspectionsBundle.message("explicit.type.argument.ref.loc.can.be.replaced.with"), ProblemHighlightType.LIKE_UNUSED_SYMBOL, range, new ReplaceWithDiamondFix());
}
}
};
@@ -64,7 +64,7 @@ public class ExplicitTypeCanBeDiamondInspection extends AbstractBaseJavaLocalIns
@NotNull
@Override
public String getFamilyName() {
return "Replace with <>";
return InspectionsBundle.message("replace.with");
}
@Override

View File

@@ -29,7 +29,8 @@ public class InvalidComparatorMethodReferenceInspection extends AbstractBaseJava
holder
.registerProblem(expression,
"Method reference mapped to Comparator interface does not fulfill the Comparator contract",
InspectionsBundle
.message("method.reference.mapped.to.comparator"),
new ReplaceWithComparatorQuickFix(name.equals("min")));
}
};
@@ -69,7 +70,7 @@ public class InvalidComparatorMethodReferenceInspection extends AbstractBaseJava
@NotNull
@Override
public String getFamilyName() {
return "Replace with comparator";
return InspectionsBundle.message("replace.with.comparator");
}
@Override

View File

@@ -28,7 +28,7 @@ public class NumericOverflowInspection extends AbstractBaseJavaLocalInspectionTo
@Nullable
@Override
public JComponent createOptionsPanel() {
return new SingleCheckboxOptionsPanel("Ignore '<<' operation which results in negative value", this,
return new SingleCheckboxOptionsPanel(InspectionsBundle.message("ignore.operation.which.results.in.negative.value"), this,
"ignoreLeftShiftWithNegativeResult");
}

View File

@@ -59,7 +59,7 @@ public class PossibleHeapPollutionVarargsInspection extends AbstractBaseJavaLoca
@NotNull
@Override
public String getFamilyName() {
return "Annotate as @SafeVarargs";
return InspectionsBundle.message("annotate.as.safevarargs");
}
@Override
@@ -91,7 +91,7 @@ public class PossibleHeapPollutionVarargsInspection extends AbstractBaseJavaLoca
@NotNull
@Override
public String getFamilyName() {
return "Make final and annotate as @SafeVarargs";
return InspectionsBundle.message("make.final.and.annotate.as.safevarargs");
}
@Nullable
@@ -158,7 +158,7 @@ public class PossibleHeapPollutionVarargsInspection extends AbstractBaseJavaLoca
final PsiElement nameIdentifier = ((PsiNameIdentifierOwner)aClass).getNameIdentifier();
if (nameIdentifier != null) {
final LocalQuickFix quickFix = new AnnotateAsSafeVarargsQuickFix();
myHolder.registerProblem(nameIdentifier, "Possible heap pollution from parameterized vararg type #loc", quickFix);
myHolder.registerProblem(nameIdentifier, InspectionsBundle.message("possible.heap.pollution.from.parameterized.vararg.type.loc"), quickFix);
}
}
@@ -198,7 +198,7 @@ public class PossibleHeapPollutionVarargsInspection extends AbstractBaseJavaLoca
OverridingMethodsSearch.search(method).findFirst() == null;
quickFix = canBeFinal ? new MakeFinalAndAnnotateQuickFix() : null;
}
myHolder.registerProblem(nameIdentifier, "Possible heap pollution from parameterized vararg type #loc", quickFix);
myHolder.registerProblem(nameIdentifier, InspectionsBundle.message("possible.heap.pollution.from.parameterized.vararg.type.loc"), quickFix);
}
}
}

View File

@@ -54,7 +54,7 @@ public class RedundantLambdaCodeBlockInspection extends AbstractBaseJavaLocalIns
} else {
errorElement = body.getFirstChild();
}
holder.registerProblem(errorElement, "Statement lambda can be replaced with expression lambda",
holder.registerProblem(errorElement, InspectionsBundle.message("statement.lambda.can.be.replaced.with.expression.lambda"),
ProblemHighlightType.LIKE_UNUSED_SYMBOL, new ReplaceWithExprFix());
}
}
@@ -100,7 +100,7 @@ public class RedundantLambdaCodeBlockInspection extends AbstractBaseJavaLocalIns
@NotNull
@Override
public String getFamilyName() {
return "Replace with expression lambda";
return InspectionsBundle.message("replace.with.expression.lambda");
}
@Override

View File

@@ -55,7 +55,7 @@ public class StringTokenizerDelimiterInspection extends AbstractBaseJavaLocalIns
final Set<Character> chars = new THashSet<>();
for (char c : delimiters.toCharArray()) {
if (!chars.add(c)) {
holder.registerProblem(delimiterArgument, "Delimiters argument contains duplicated characters",
holder.registerProblem(delimiterArgument, InspectionsBundle.message("delimiters.argument.contains.duplicated.characters"),
new ReplaceDelimitersWithUnique(delimiterArgument));
return;
}
@@ -78,7 +78,7 @@ public class StringTokenizerDelimiterInspection extends AbstractBaseJavaLocalIns
@NotNull
@Override
public String getFamilyName() {
return "Replace StringTokenizer delimiters parameter with unique symbols";
return InspectionsBundle.message("replace.stringtokenizer.delimiters.parameter.with.unique.symbols");
}
@Override

View File

@@ -47,7 +47,7 @@ public class VariableTypeCanBeExplicitInspection extends AbstractBaseJavaLocalIn
private void registerTypeElementProblem(PsiTypeElement typeElement) {
holder.registerProblem(typeElement,
"'var' can be replaced with explicit type",
InspectionsBundle.message("var.can.be.replaced.with.explicit.type"),
ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
new ReplaceVarWithExplicitTypeFix());
}
@@ -70,7 +70,7 @@ public class VariableTypeCanBeExplicitInspection extends AbstractBaseJavaLocalIn
@NotNull
@Override
public String getFamilyName() {
return "Replace 'var' with explicit type";
return InspectionsBundle.message("replace.var.with.explicit.type");
}
@Override

View File

@@ -147,7 +147,8 @@ public class JavacQuirksInspectionVisitor extends JavaElementVisitor {
for (int i = method.getParameterList().getParametersCount(); i < args.length; i++) {
if (PsiPolyExpressionUtil.isPolyExpression(args[i]) && ++ count > 50) {
myHolder.registerProblem(expression.getMethodExpression(),
"Vararg method call with 50+ poly arguments may cause compilation and analysis slowdown",
InspectionsBundle
.message("vararg.method.call.with.50.poly.arguments"),
new MyAddExplicitTypeArgumentsFix());
break;
}
@@ -170,7 +171,8 @@ public class JavacQuirksInspectionVisitor extends JavaElementVisitor {
(TypeConversionUtil.isPrimitiveAndNotNull(ltype) ^ TypeConversionUtil.isPrimitiveAndNotNull(rtype)) &&
TypeConversionUtil.isBinaryOperatorApplicable(expression.getOperationTokenType(), ltype, rtype, false) &&
TypeConversionUtil.areTypesConvertible(rtype, ltype)) {
myHolder.registerProblem(expression.getOperationSign(), "Comparision between Object and primitive is illegal and is accepted in java 7 only", ProblemHighlightType.GENERIC_ERROR_OR_WARNING);
myHolder.registerProblem(expression.getOperationSign(), InspectionsBundle
.message("comparision.between.object.and.primitive"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING);
}
}
}
@@ -187,14 +189,14 @@ public class JavacQuirksInspectionVisitor extends JavaElementVisitor {
@NotNull
@Override
public String getName() {
return "Replace ''" + myOperationSign + "'' with ''=''";
return InspectionsBundle.message("replace.0.with", myOperationSign);
}
@Nls
@NotNull
@Override
public String getFamilyName() {
return "Replace Operator Assignment with Assignment";
return InspectionsBundle.message("replace.operator.assignment.with.assignment");
}
@Override

View File

@@ -4,6 +4,7 @@ package com.intellij.codeInspection.concurrencyAnnotations;
import com.intellij.codeInsight.PsiEquivalenceUtil;
import com.intellij.codeInsight.daemon.GroupNames;
import com.intellij.codeInspection.AbstractBaseJavaLocalInspectionTool;
import com.intellij.codeInspection.InspectionsBundle;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.psi.*;
import com.intellij.psi.util.InheritanceUtil;
@@ -182,7 +183,7 @@ public class FieldAccessNotGuardedInspection extends AbstractBaseJavaLocalInspec
}
check = syncStatement;
}
myHolder.registerProblem(expression, "Access to field <code>#ref</code> outside of declared guards #loc");
myHolder.registerProblem(expression, InspectionsBundle.message("access.to.field.code.ref.code.outside.of.declared.guards.loc"));
}
private static PsiClass getClassFromThisExpression(PsiThisExpression thisExpression, PsiElement context) {

View File

@@ -3,6 +3,7 @@ package com.intellij.codeInspection.concurrencyAnnotations;
import com.intellij.codeInsight.daemon.GroupNames;
import com.intellij.codeInspection.AbstractBaseJavaLocalInspectionTool;
import com.intellij.codeInspection.InspectionsBundle;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.psi.*;
import com.intellij.psi.javadoc.PsiDocTag;
@@ -64,7 +65,7 @@ public class InstanceGuardedByStaticInspection extends AbstractBaseJavaLocalInsp
if (!guardField.hasModifierProperty(PsiModifier.STATIC)) {
return;
}
myHolder.registerProblem(psiDocTag, "Instance member guarded by static \"" + guardValue + "\" #loc");
myHolder.registerProblem(psiDocTag, InspectionsBundle.message("instance.member.guarded.by.static.0.loc", guardValue));
}
@Override
@@ -100,7 +101,7 @@ public class InstanceGuardedByStaticInspection extends AbstractBaseJavaLocalInsp
if (!guardField.hasModifierProperty(PsiModifier.STATIC)) {
return;
}
myHolder.registerProblem(guardRef, "Instance member guarded by static #ref #loc");
myHolder.registerProblem(guardRef, InspectionsBundle.message("instance.member.guarded.by.static.ref.loc"));
}
}
}

View File

@@ -3,6 +3,7 @@ package com.intellij.codeInspection.concurrencyAnnotations;
import com.intellij.codeInsight.daemon.GroupNames;
import com.intellij.codeInspection.AbstractBaseJavaLocalInspectionTool;
import com.intellij.codeInspection.InspectionsBundle;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.psi.*;
import org.jetbrains.annotations.Nls;
@@ -38,7 +39,8 @@ public class NonFinalFieldInImmutableInspection extends AbstractBaseJavaLocalIns
if (!JCiPUtil.isImmutable(containingClass)) {
return;
}
holder.registerProblem(field.getNameIdentifier(), "Non-final field <code>#ref</code> in @Immutable class #loc");
holder.registerProblem(field.getNameIdentifier(),
InspectionsBundle.message("non.final.field.code.ref.code.in.immutable.class.loc"));
}
}
};

View File

@@ -3,11 +3,11 @@ package com.intellij.codeInspection.concurrencyAnnotations;
import com.intellij.codeInsight.daemon.GroupNames;
import com.intellij.codeInspection.AbstractBaseJavaLocalInspectionTool;
import com.intellij.codeInspection.InspectionsBundle;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.psi.*;
import com.intellij.psi.javadoc.PsiDocTag;
import com.intellij.psi.util.PsiTreeUtil;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
public class NonFinalGuardInspection extends AbstractBaseJavaLocalInspectionTool {
@@ -64,7 +64,7 @@ public class NonFinalGuardInspection extends AbstractBaseJavaLocalInspectionTool
if (member == null) {
return;
}
myHolder.registerProblem(member, "Non-final @GuardedBy field #ref #loc");
myHolder.registerProblem(member, InspectionsBundle.message("non.final.guarded.by.field.ref.loc"));
}
@Override
@@ -88,7 +88,7 @@ public class NonFinalGuardInspection extends AbstractBaseJavaLocalInspectionTool
if (guardField.hasModifierProperty(PsiModifier.FINAL)) {
return;
}
myHolder.registerProblem(psiDocTag, "Non-final @GuardedBy field \"" + guardValue + "\" #loc");
myHolder.registerProblem(psiDocTag, InspectionsBundle.message("non.final.guarded.by.field.0.loc", guardValue));
}
}
}

View File

@@ -3,6 +3,7 @@ package com.intellij.codeInspection.concurrencyAnnotations;
import com.intellij.codeInsight.daemon.GroupNames;
import com.intellij.codeInspection.AbstractBaseJavaLocalInspectionTool;
import com.intellij.codeInspection.InspectionsBundle;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.psi.*;
import com.intellij.psi.javadoc.PsiDocTag;
@@ -105,11 +106,11 @@ public class StaticGuardedByInstanceInspection extends AbstractBaseJavaLocalInsp
if (guardField.hasModifierProperty(PsiModifier.STATIC)) {
return;
}
myHolder.registerProblem(psiDocTag, "Static member guarded by instance \"" + guardValue + "\" #loc");
myHolder.registerProblem(psiDocTag, InspectionsBundle.message("static.member.guarded.by.instance.0.loc", guardValue));
}
private void registerError(PsiElement element) {
myHolder.registerProblem(element, "Static member guarded by instance #ref #loc");
myHolder.registerProblem(element, InspectionsBundle.message("static.member.guarded.by.instance.ref.loc"));
}
}
}

View File

@@ -3,6 +3,7 @@ package com.intellij.codeInspection.concurrencyAnnotations;
import com.intellij.codeInsight.daemon.GroupNames;
import com.intellij.codeInspection.AbstractBaseJavaLocalInspectionTool;
import com.intellij.codeInspection.InspectionsBundle;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.psi.*;
import com.intellij.psi.impl.source.DummyHolder;
@@ -57,7 +58,7 @@ public class UnknownGuardInspection extends AbstractBaseJavaLocalInspectionTool
if (member == null) {
return;
}
myHolder.registerProblem(member, "Unknown @GuardedBy reference #ref #loc");
myHolder.registerProblem(member, InspectionsBundle.message("unknown.guardedby.reference.ref.loc"));
}
private static boolean isValidGuardText(@Nullable String guardText, @NotNull PsiElement context) {
@@ -161,7 +162,7 @@ public class UnknownGuardInspection extends AbstractBaseJavaLocalInspectionTool
if (isValidGuardText(guardValue, psiDocTag)) {
return;
}
myHolder.registerProblem(psiDocTag, "Unknown @GuardedBy reference \"" + guardValue + "\" #loc");
myHolder.registerProblem(psiDocTag, InspectionsBundle.message("unknown.guardedby.reference.0.loc", guardValue));
}
}
}

View File

@@ -1,6 +1,7 @@
// 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.
package com.intellij.codeInspection.dataFlow.fix;
import com.intellij.codeInspection.InspectionsBundle;
import com.intellij.codeInspection.LocalQuickFix;
import com.intellij.codeInspection.ProblemDescriptor;
import com.intellij.openapi.project.Project;
@@ -48,15 +49,15 @@ public class DeleteSwitchLabelFix implements LocalQuickFix {
@Override
public String getName() {
return myBranch ?
"Remove switch branch '" + myName + "'" :
"Remove switch label '" + myName + "'";
InspectionsBundle.message("remove.switch.branch.0", myName) :
InspectionsBundle.message("remove.switch.label.0", myName);
}
@Nls(capitalization = Nls.Capitalization.Sentence)
@NotNull
@Override
public String getFamilyName() {
return "Remove switch label";
return InspectionsBundle.message("remove.switch.label");
}
@Override

View File

@@ -16,6 +16,7 @@
package com.intellij.codeInspection.dataFlow.fix;
import com.intellij.codeInspection.CommonQuickFixBundle;
import com.intellij.codeInspection.InspectionsBundle;
import com.intellij.codeInspection.LocalQuickFix;
import com.intellij.codeInspection.ProblemDescriptor;
import com.intellij.openapi.project.Project;
@@ -44,7 +45,7 @@ public class ReplaceWithConstantValueFix implements LocalQuickFix {
@NotNull
@Override
public String getFamilyName() {
return "Replace with constant value";
return InspectionsBundle.message("replace.with.constant.value");
}
@Override

View File

@@ -2,6 +2,7 @@
package com.intellij.codeInspection.deprecation;
import com.intellij.codeInspection.DeprecationUtil;
import com.intellij.codeInspection.InspectionsBundle;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.codeInspection.apiUsage.ApiUsageUastVisitor;
import com.intellij.codeInspection.ui.MultipleCheckboxOptionsPanel;
@@ -56,10 +57,10 @@ public class DeprecationInspection extends DeprecationInspectionBase {
@Override
public JComponent createOptionsPanel() {
final MultipleCheckboxOptionsPanel panel = new MultipleCheckboxOptionsPanel(this);
panel.addCheckbox("Ignore inside deprecated members", "IGNORE_INSIDE_DEPRECATED");
panel.addCheckbox("Ignore inside non-static imports", "IGNORE_IMPORT_STATEMENTS");
panel.addCheckbox("<html>Ignore overrides of deprecated abstract methods from non-deprecated supers</html>", "IGNORE_ABSTRACT_DEPRECATED_OVERRIDES");
panel.addCheckbox("Ignore members of deprecated classes", IGNORE_METHODS_OF_DEPRECATED_NAME);
panel.addCheckbox(InspectionsBundle.message("ignore.inside.deprecated.members"), "IGNORE_INSIDE_DEPRECATED");
panel.addCheckbox(InspectionsBundle.message("ignore.inside.non.static.imports"), "IGNORE_IMPORT_STATEMENTS");
panel.addCheckbox(InspectionsBundle.message("html.ignore.overrides.of.deprecated.abstract.methods"), "IGNORE_ABSTRACT_DEPRECATED_OVERRIDES");
panel.addCheckbox(InspectionsBundle.message("ignore.members.of.deprecated.classes"), IGNORE_METHODS_OF_DEPRECATED_NAME);
addSameOutermostClassCheckBox(panel);
return panel;
}

View File

@@ -4,10 +4,7 @@ package com.intellij.codeInspection.deprecation;
import com.intellij.codeInsight.AnnotationUtil;
import com.intellij.codeInsight.daemon.JavaErrorBundle;
import com.intellij.codeInsight.daemon.impl.analysis.HighlightMessageUtil;
import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.codeInspection.LocalQuickFix;
import com.intellij.codeInspection.ProblemHighlightType;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.codeInspection.*;
import com.intellij.codeInspection.ui.MultipleCheckboxOptionsPanel;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.util.TextRange;
@@ -150,7 +147,7 @@ public abstract class DeprecationInspectionBase extends LocalInspectionTool {
}
static void addSameOutermostClassCheckBox(MultipleCheckboxOptionsPanel panel) {
panel.addCheckbox("Ignore in the same outermost class", "IGNORE_IN_SAME_OUTERMOST_CLASS");
panel.addCheckbox(InspectionsBundle.message("ignore.in.the.same.outermost.class"), "IGNORE_IN_SAME_OUTERMOST_CLASS");
}
protected static String getDescription(@NotNull String description, boolean forRemoval, ProblemHighlightType highlightType) {

View File

@@ -62,8 +62,9 @@ public class InconsistentLanguageLevelInspection extends GlobalInspectionTool {
LanguageLevel dependantLanguageLevel = EffectiveLanguageLevelUtil.getEffectiveLanguageLevel(dependantModule);
if (languageLevel.compareTo(dependantLanguageLevel) < 0) {
final CommonProblemDescriptor problemDescriptor = manager.createProblemDescriptor(
"Module " + module.getName() + " with language level " + languageLevel +
" depends on module " + dependantModule.getName() +" with language level " + dependantLanguageLevel,
InspectionsBundle
.message("module.0.with.language.level.1.depends.on.module.2.with.language.level.3", module.getName(), languageLevel,
dependantModule.getName(), dependantLanguageLevel),
module,
new UnnecessaryModuleDependencyInspection.RemoveModuleDependencyFix(dependantModule.getName()),
(QuickFix)QuickFixFactory.getInstance().createShowModulePropertiesFix(module));

View File

@@ -2,6 +2,7 @@
package com.intellij.codeInspection.java19modules;
import com.intellij.codeInsight.daemon.impl.analysis.JavaModuleGraphUtil;
import com.intellij.codeInspection.InspectionsBundle;
import com.intellij.codeInspection.reference.*;
import com.intellij.codeInspection.visibility.EntryPointWithVisibilityLevel;
import com.intellij.openapi.util.InvalidDataException;
@@ -38,7 +39,7 @@ public class Java9ModuleEntryPoint extends EntryPointWithVisibilityLevel {
@NotNull
@Override
public String getDisplayName() {
return "<html>Classes exposed with <code>module-info</code></html>";
return InspectionsBundle.message("html.classes.exposed.with.code.module.info.code.html");
}
@Override

View File

@@ -16,6 +16,7 @@
package com.intellij.codeInspection.nullable;
import com.intellij.codeInsight.NullableNotNullManager;
import com.intellij.codeInspection.InspectionsBundle;
import com.intellij.codeInspection.LocalQuickFix;
import com.intellij.codeInspection.ProblemDescriptor;
import com.intellij.openapi.project.Project;
@@ -43,7 +44,7 @@ class ChangeNullableDefaultsFix implements LocalQuickFix {
@NotNull
@Override
public String getFamilyName() {
return "Make \"" + (myNotNullName != null ? myNotNullName : myNullableName) + "\" default annotation";
return InspectionsBundle.message("make.0.default.annotation", myNotNullName != null ? myNotNullName : myNullableName);
}
@Override

View File

@@ -8,7 +8,6 @@ import com.intellij.codeInsight.intention.AddAnnotationPsiFix;
import com.intellij.codeInspection.*;
import com.intellij.codeInspection.dataFlow.DfaPsiUtil;
import com.intellij.codeInspection.dataFlow.instructions.MethodCallInstruction;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.GeneratedSourcesFilter;
@@ -159,7 +158,8 @@ public class NullableStuffInspectionBase extends AbstractBaseJavaLocalInspection
PsiClass psiClass = PsiUtil.resolveClassInClassTypeOnly(((PsiClassObjectAccessExpression)value).getOperand().getType());
if (psiClass != null && !hasStringConstructor(psiClass)) {
holder.registerProblem(value,
"Custom exception class should have a constructor with a single message parameter of String type",
InspectionsBundle.message(
"custom.exception.class.should.have.a.constructor"),
ProblemHighlightType.GENERIC_ERROR_OR_WARNING);
}
@@ -205,7 +205,7 @@ public class NullableStuffInspectionBase extends AbstractBaseJavaLocalInspection
if (DfaPsiUtil.getTypeNullability(JavaPsiFacade.getElementFactory(element.getProject()).createType(typeParameters[i])) ==
Nullability.NOT_NULL && DfaPsiUtil.getTypeNullability(typeArguments[i].getType()) != Nullability.NOT_NULL) {
holder.registerProblem(typeArguments[i],
"Non-null type argument is expected",
InspectionsBundle.message("non.null.type.argument.is.expected"),
ProblemHighlightType.GENERIC_ERROR_OR_WARNING);
}
}
@@ -280,7 +280,8 @@ public class NullableStuffInspectionBase extends AbstractBaseJavaLocalInspection
@Nullable PsiType assignedType) {
if (isNullableNotNullCollectionConflict(expectedType, assignedType, new HashSet<>())) {
holder.registerProblem(errorElement,
"Assigning a collection of nullable elements into a collection of non-null elements",
InspectionsBundle
.message("assigning.a.collection.of.nullable.elements"),
ProblemHighlightType.GENERIC_ERROR_OR_WARNING);
}
@@ -392,7 +393,8 @@ public class NullableStuffInspectionBase extends AbstractBaseJavaLocalInspection
}
else if (isNonAnnotatedOverridingNotNull(targetMethod, superMethod)) {
holder.registerProblem(refName,
"Not annotated method is used as an override for a method annotated with " + getPresentableAnnoName(superMethod),
InspectionsBundle.message("not.annotated.method.is.used.as.an.override.for.a.method.annotated.with.0",
getPresentableAnnoName(superMethod)),
ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
createFixForNonAnnotatedOverridesNotNull(targetMethod, superMethod));
}
@@ -540,7 +542,8 @@ public class NullableStuffInspectionBase extends AbstractBaseJavaLocalInspection
PsiIdentifier nameIdentifier = field.getNameIdentifier();
if (nameIdentifier.isPhysical()) {
holder.registerProblem(nameIdentifier, "@" + getPresentableAnnoName(field) + " field is always initialized not-null",
holder.registerProblem(nameIdentifier,
InspectionsBundle.message("0.field.is.always.initialized.not.null", getPresentableAnnoName(field)),
ProblemHighlightType.GENERIC_ERROR_OR_WARNING, AddAnnotationPsiFix.createAddNotNullFix(field));
}
}
@@ -610,11 +613,11 @@ public class NullableStuffInspectionBase extends AbstractBaseJavaLocalInspection
private static void checkLoopParameterNullability(ProblemsHolder holder, @Nullable PsiAnnotation notNull, @Nullable PsiAnnotation nullable, Nullability expectedNullability) {
if (notNull != null && expectedNullability == Nullability.NULLABLE) {
holder.registerProblem(notNull, "Parameter can be null",
holder.registerProblem(notNull, InspectionsBundle.message("parameter.can.be.null"),
new RemoveAnnotationQuickFix(notNull, null));
}
else if (nullable != null && expectedNullability == Nullability.NOT_NULL) {
holder.registerProblem(nullable, "Parameter is always not-null",
holder.registerProblem(nullable, InspectionsBundle.message("parameter.is.always.not.null"),
new RemoveAnnotationQuickFix(nullable, null));
}
}

View File

@@ -62,7 +62,7 @@ public class RedundantCastInspection extends GenericsInspectionToolBase {
@Override
public JComponent createOptionsPanel() {
final MultipleCheckboxOptionsPanel optionsPanel = new MultipleCheckboxOptionsPanel(this);
optionsPanel.addCheckbox("Ignore casts in suspicious collections method calls", "IGNORE_SUSPICIOUS_METHOD_CALLS");
optionsPanel.addCheckbox(InspectionsBundle.message("ignore.casts.in.suspicious.collections.method.calls"), "IGNORE_SUSPICIOUS_METHOD_CALLS");
return optionsPanel;
}

View File

@@ -91,7 +91,7 @@ public class TestOnlyInspection extends AbstractBaseJavaLocalInspectionTool {
if (toHighlight == null) {
toHighlight = element;
}
h.registerProblem(toHighlight, "@VisibleForTesting makes little sense on @TestOnly code", new RemoveAnnotationQuickFix(vft, (PsiModifierListOwner)element));
h.registerProblem(toHighlight, InspectionsBundle.message("visible.for.testing.makes.little.sense.on.test.only.code"), new RemoveAnnotationQuickFix(vft, (PsiModifierListOwner)element));
}
}
super.visitElement(element);

View File

@@ -135,7 +135,7 @@ public class UnnecessaryModuleDependencyInspection extends GlobalInspectionTool
@Override
@NotNull
public String getFamilyName() {
return "Remove dependency";
return InspectionsBundle.message("remove.dependency");
}
@Override

View File

@@ -39,7 +39,7 @@ public class RedundantThrowsDeclarationInspection extends GlobalJavaBatchInspect
@Nullable
@Override
public JComponent createOptionsPanel() {
return new SingleCheckboxOptionsPanel("Ignore exceptions thrown by entry points methods", this, "IGNORE_ENTRY_POINTS");
return new SingleCheckboxOptionsPanel(InspectionsBundle.message("ignore.exceptions.thrown.by.entry.points.methods"), this, "IGNORE_ENTRY_POINTS");
}
@Override

View File

@@ -63,7 +63,7 @@ public class UnusedLibrariesInspection extends GlobalInspectionTool {
@Nullable
@Override
public JComponent createOptionsPanel() {
return new SingleCheckboxOptionsPanel("Don't report unused jars inside used library", this, "IGNORE_LIBRARY_PARTS");
return new SingleCheckboxOptionsPanel(InspectionsBundle.message("don.t.report.unused.jars.inside.used.library"), this, "IGNORE_LIBRARY_PARTS");
}
@Nullable

View File

@@ -4,6 +4,7 @@ package com.intellij.codeInspection.visibility;
import com.intellij.codeInsight.daemon.GroupNames;
import com.intellij.codeInsight.daemon.impl.UnusedSymbolUtil;
import com.intellij.codeInspection.AbstractBaseJavaLocalInspectionTool;
import com.intellij.codeInspection.InspectionsBundle;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.codeInspection.deadCode.UnusedDeclarationInspectionBase;
import com.intellij.codeInspection.inheritance.ImplicitSubclassProvider;
@@ -124,7 +125,8 @@ class AccessCanBeTightenedInspection extends AbstractBaseJavaLocalInspectionTool
// can be null in some strange cases of malbuilt PSI, like in EA-95877
if (toHighlight != null) {
String suggestedModifier = PsiUtil.getAccessModifier(suggestedLevel);
myHolder.registerProblem(toHighlight, "Access can be " + VisibilityUtil.toPresentableText(suggestedModifier), new ChangeModifierFix(suggestedModifier));
myHolder.registerProblem(toHighlight,
InspectionsBundle.message("access.can.be.0", VisibilityUtil.toPresentableText(suggestedModifier)), new ChangeModifierFix(suggestedModifier));
}
}
}

View File

@@ -1,10 +1,7 @@
// 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.
package com.intellij.codeInspection.xml;
import com.intellij.codeInspection.LocalInspectionToolSession;
import com.intellij.codeInspection.ProblemHighlightType;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.codeInspection.XmlSuppressableInspectionTool;
import com.intellij.codeInspection.*;
import com.intellij.codeInspection.deprecation.DeprecationInspectionBase;
import com.intellij.psi.*;
import com.intellij.psi.xml.XmlAttributeValue;
@@ -59,7 +56,7 @@ public class DeprecatedClassUsageInspection extends XmlSuppressableInspectionToo
@NotNull
@Override
public String getGroupDisplayName() {
return "XML";
return InspectionsBundle.message("deprecated.class.usage.group.xml");
}
@NotNull

View File

@@ -1123,4 +1123,68 @@ inspection.redundant.record.constructor.statement.message=Redundant field assign
inspection.redundant.record.constructor.canonical.message=Redundant canonical constructor
inspection.redundant.record.constructor.can.be.compact.message=Canonical constructor can be converted to compact form
inspection.redundant.record.constructor.fix.family.name=Convert canonical constructor to compact form
action.presentation.ScopesChooser.text=In All Scopes
action.presentation.ScopesChooser.text=In All Scopes
non.final.guarded.by.field.0.loc=Non-final @GuardedBy field \\"{0}\\" #loc
non.final.guarded.by.field.ref.loc=Non-final @GuardedBy field #ref #loc
access.can.be.0=Access can be {0}
don.t.report.unused.jars.inside.used.library=Don't report unused jars inside used library
non.final.field.code.ref.code.in.immutable.class.loc=Non-final field <code>#ref</code> in @Immutable class #loc
deprecated.class.usage.group.xml=XML
replace.with.comparator=Replace with comparator
method.reference.mapped.to.comparator=Method reference mapped to Comparator interface does not fulfill the Comparator contract
static.member.guarded.by.instance.ref.loc=Static member guarded by instance #ref #loc
static.member.guarded.by.instance.0.loc=Static member guarded by instance \\"{0}\\" #loc
deprecated.member.0.is.still.used=Deprecated member ''{0}'' is still used
access.to.field.code.ref.code.outside.of.declared.guards.loc=Access to field <code>#ref</code> outside of declared guards #loc
replace.stringtokenizer.delimiters.parameter.with.unique.symbols=Replace StringTokenizer delimiters parameter with unique symbols
delimiters.argument.contains.duplicated.characters=Delimiters argument contains duplicated characters
make.0.default.annotation=Make \\"{0}\\" default annotation
remove.block.marker.comments=Remove block marker comments
redundant.block.marker=Redundant block marker
parameter.is.always.not.null=Parameter is always not-null
parameter.can.be.null=Parameter can be null
0.field.is.always.initialized.not.null=@{0} field is always initialized not-null
not.annotated.method.is.used.as.an.override.for.a.method.annotated.with.0=Not annotated method is used as an override for a method annotated with {0}
assigning.a.collection.of.nullable.elements=Assigning a collection of nullable elements into a collection of non-null elements
non.null.type.argument.is.expected=Non-null type argument is expected
custom.exception.class.should.have.a.constructor=Custom exception class should have a constructor with a single message parameter of String type
html.classes.exposed.with.code.module.info.code.html=<html>Classes exposed with <code>module-info</code></html>
ignore.operation.which.results.in.negative.value=Ignore '<<' operation which results in negative value
visible.for.testing.makes.little.sense.on.test.only.code=@VisibleForTesting makes little sense on @TestOnly code
ignore.in.the.same.outermost.class=Ignore in the same outermost class
replace.anonymous.class.with.lambda.alternative=Replace anonymous class with lambda alternative
replace.with.0=Replace with {0}
anonymous.ref.loc.can.be.replaced.with.0=Anonymous #ref #loc can be replaced with {0}
replace.with=Replace with <>
explicit.type.argument.ref.loc.can.be.replaced.with=Explicit type argument #ref #loc can be replaced with <>
replace.with.constant.value=Replace with constant value
possible.heap.pollution.from.parameterized.vararg.type.loc=Possible heap pollution from parameterized vararg type #loc
make.final.and.annotate.as.safevarargs=Make final and annotate as @SafeVarargs
annotate.as.safevarargs=Annotate as @SafeVarargs
ignore.members.of.deprecated.classes=Ignore members of deprecated classes
html.ignore.overrides.of.deprecated.abstract.methods=<html>Ignore overrides of deprecated abstract methods from non-deprecated supers</html>
ignore.inside.non.static.imports=Ignore inside non-static imports
ignore.inside.deprecated.members=Ignore inside deprecated members
module.0.with.language.level.1.depends.on.module.2.with.language.level.3=Module {0} with language level {1} depends on module {2} with language level {3}
ignore.casts.in.suspicious.collections.method.calls=Ignore casts in suspicious collections method calls
replace.with.lambda=Replace with lambda
anonymous.ref.loc.can.be.replaced.with.lambda=Anonymous #ref #loc can be replaced with lambda
report.when.interface.is.not.annotated.with.functional.interface=Report when interface is not annotated with @FunctionalInterface
instance.member.guarded.by.static.ref.loc=Instance member guarded by static #ref #loc
instance.member.guarded.by.static.0.loc=Instance member guarded by static \\"{0}\\" #loc
replace.var.with.explicit.type=Replace 'var' with explicit type
var.can.be.replaced.with.explicit.type='var' can be replaced with explicit type
replace.operator.assignment.with.assignment=Replace Operator Assignment with Assignment
replace.0.with=Replace ''''{0}'''' with ''''=''''
comparision.between.object.and.primitive=Comparision between Object and primitive is illegal and is accepted in java 7 only
vararg.method.call.with.50.poly.arguments=Vararg method call with 50+ poly arguments may cause compilation and analysis slowdown
replace.with.expression.lambda=Replace with expression lambda
statement.lambda.can.be.replaced.with.expression.lambda=Statement lambda can be replaced with expression lambda
unknown.guardedby.reference.0.loc=Unknown @GuardedBy reference \\"{0}\\" #loc
unknown.guardedby.reference.ref.loc=Unknown @GuardedBy reference #ref #loc
ignore.exceptions.thrown.by.entry.points.methods=Ignore exceptions thrown by entry points methods
remove.dependency=Remove dependency
searching.for.overriding.methods=Searching for Overriding Methods
remove.switch.label=Remove switch label
remove.switch.label.0=Remove switch label ''{0}''
remove.switch.branch.0=Remove switch branch ''{0}''