mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[i18n] move some properties used in java.analysis.impl module to JavaAnalysisBundle (IDEA-209382)
GitOrigin-RevId: 756f72421ba11d9e9d9cf1511552a000a010677f
This commit is contained in:
committed by
intellij-monorepo-bot
parent
2e269c30ea
commit
e4ad02bfd2
@@ -1,10 +1,117 @@
|
||||
add.explicit.type.arguments=Add explicit type arguments
|
||||
|
||||
# suppress inspection "UnusedProperty"
|
||||
annotation.target.ANNOTATION_TYPE=annotation type
|
||||
# suppress inspection "UnusedProperty"
|
||||
annotation.target.CONSTRUCTOR=constructor
|
||||
# suppress inspection "UnusedProperty"
|
||||
annotation.target.FIELD=field
|
||||
# suppress inspection "UnusedProperty"
|
||||
annotation.target.LOCAL_VARIABLE=local variable
|
||||
# suppress inspection "UnusedProperty"
|
||||
annotation.target.METHOD=method
|
||||
# suppress inspection "UnusedProperty"
|
||||
annotation.target.MODULE=module
|
||||
# suppress inspection "UnusedProperty"
|
||||
annotation.target.PACKAGE=package
|
||||
# suppress inspection "UnusedProperty"
|
||||
annotation.target.PARAMETER=parameter
|
||||
# suppress inspection "UnusedProperty"
|
||||
annotation.target.RECORD_COMPONENT=record component
|
||||
# suppress inspection "UnusedProperty"
|
||||
annotation.target.TYPE=type
|
||||
# suppress inspection "UnusedProperty"
|
||||
annotation.target.TYPE_PARAMETER=type parameter
|
||||
# suppress inspection "UnusedProperty"
|
||||
annotation.target.TYPE_USE=type use
|
||||
|
||||
change.type.arguments=Change type arguments
|
||||
change.type.arguments.to.0=Change type arguments to <{0}>
|
||||
convert.0.to.float=Convert ''{0}'' to float
|
||||
|
||||
dataflow.message.array.index.out.of.bounds=Array index is out of bounds
|
||||
dataflow.message.arraystore=Storing element of type <code>{0}</code> to array of <code>{1}</code> elements may produce <code>ArrayStoreException</code>
|
||||
dataflow.message.assigning.null.notannotated=Assigning <code>null</code> value to non-annotated field
|
||||
dataflow.message.assigning.null=<code>null</code> is assigned to a variable that is annotated with @NotNull
|
||||
dataflow.message.assigning.nullable.notannotated=Expression <code>#ref</code> #loc might be null but is assigned to non-annotated field
|
||||
dataflow.message.assigning.nullable=Expression <code>#ref</code> might evaluate to null but is assigned to a variable that is annotated with @NotNull
|
||||
dataflow.message.cce.always=Casting <code>{0}</code> to <code>#ref</code> #loc will produce <code>ClassCastException</code> for any non-null value
|
||||
dataflow.message.cce=Casting <code>{0}</code> to <code>#ref</code> #loc may produce <code>ClassCastException</code>
|
||||
dataflow.message.constant.condition.when.reached=Condition <code>#ref</code> #loc is always <code>{0, choice, 0#false|1#true}</code> when reached
|
||||
dataflow.message.constant.condition=Condition <code>#ref</code> #loc is always <code>{0, choice, 0#false|1#true}</code>
|
||||
dataflow.message.constant.method.reference=Method reference result is always ''{0}''
|
||||
dataflow.message.constant.no.ref=Condition is always {0, choice, 0#false|1#true}
|
||||
dataflow.message.contract.fail.index=The call to '#ref' always fails as index is out of bounds
|
||||
dataflow.message.contract.fail=The call to '#ref' always fails, according to its method contracts
|
||||
dataflow.message.immutable.modified=Immutable object is modified
|
||||
dataflow.message.immutable.passed=Immutable object is passed where mutable is expected
|
||||
dataflow.message.npe.array.access.sure=Array access <code>#ref</code> #loc will produce <code>NullPointerException</code>
|
||||
dataflow.message.npe.array.access=Array access <code>#ref</code> #loc may produce <code>NullPointerException</code>
|
||||
dataflow.message.npe.field.access.sure=Dereference of <code>#ref</code> #loc will produce <code>NullPointerException</code>
|
||||
dataflow.message.npe.field.access=Dereference of <code>#ref</code> #loc may produce <code>NullPointerException</code>
|
||||
dataflow.message.npe.inner.class.construction.sure=Inner class construction will produce <code>NullPointerException</code>
|
||||
dataflow.message.npe.inner.class.construction=Inner class construction may produce <code>NullPointerException</code>
|
||||
dataflow.message.npe.method.invocation.sure=Method invocation <code>#ref</code> #loc will produce <code>NullPointerException</code>
|
||||
dataflow.message.npe.method.invocation=Method invocation <code>#ref</code> #loc may produce <code>NullPointerException</code>
|
||||
dataflow.message.npe.methodref.invocation=Method reference invocation <code>#ref</code> #loc may produce <code>NullPointerException</code>
|
||||
dataflow.message.only.switch.label=Switch label <code>#ref</code> #loc is the only reachable in the whole switch
|
||||
dataflow.message.passing.null.argument.nonannotated=Passing <code>null</code> argument to non-annotated parameter
|
||||
dataflow.message.passing.null.argument=Passing <code>null</code> argument to parameter annotated as @NotNull
|
||||
dataflow.message.passing.nullable.argument.methodref.nonannotated=Method reference argument might be null but passed to non-annotated parameter
|
||||
dataflow.message.passing.nullable.argument.methodref=Method reference argument might be null
|
||||
dataflow.message.passing.nullable.argument.nonannotated=Argument <code>#ref</code> #loc might be null but passed to non-annotated parameter
|
||||
dataflow.message.passing.nullable.argument=Argument <code>#ref</code> #loc might be null
|
||||
dataflow.message.pointless.assignment.expression=Condition <code>#ref</code> #loc at the left side of assignment expression is always <code>{0}</code>. Can be simplified
|
||||
dataflow.message.pointless.same.arguments=Arguments of '#ref' are the same. Calling this method with the same arguments is meaningless.
|
||||
dataflow.message.redundant.assignment=Variable is already assigned to this value
|
||||
dataflow.message.redundant.instanceof=Condition <code>#ref</code> #loc is redundant and can be replaced with a null check
|
||||
dataflow.message.redundant.update=Variable update does nothing
|
||||
dataflow.message.return.null.from.notnull=<code>null</code> is returned by the method declared as @{0}
|
||||
dataflow.message.return.null.from.notnullable=<code>null</code> is returned by the method which is not declared as @{0}
|
||||
dataflow.message.return.nullable.from.notnull.function=Function may return null, but it's not allowed here
|
||||
dataflow.message.return.nullable.from.notnull=Expression <code>#ref</code> might evaluate to null but is returned by the method declared as @{0}
|
||||
dataflow.message.return.nullable.from.notnullable=Expression <code>#ref</code> might evaluate to null but is returned by the method which is not declared as @{0}
|
||||
dataflow.message.storing.array.null=<code>null</code> is stored to an array of @NotNull elements
|
||||
dataflow.message.storing.array.nullable=Expression <code>#ref</code> might evaluate to null but is stored to an array of @NotNull elements
|
||||
dataflow.message.unboxing.method.reference=Use of <code>#ref</code> #loc would need unboxing which may produce <code>NullPointerException</code>
|
||||
dataflow.message.unboxing=Unboxing of <code>#ref</code> #loc may produce <code>NullPointerException</code>
|
||||
dataflow.message.unreachable.switch.label=Switch label <code>#ref</code> #loc is unreachable
|
||||
dataflow.method.fails.with.null.argument=Method will throw an exception when parameter is null
|
||||
dataflow.not.precise={0} is complex: data flow results could be imprecise
|
||||
dataflow.too.complex={0} is too complex to analyze by data flow algorithm
|
||||
|
||||
delete.repeated.0=Delete repeated ''{0}''
|
||||
delete.repeated.interface=Delete repeated interface
|
||||
exception.removal.will.break.source.code.proceed.anyway=Exception removal will break source code. Proceed anyway?
|
||||
|
||||
feature.generics=Generics
|
||||
feature.annotations=Annotations
|
||||
feature.static.imports=Static imports
|
||||
feature.for.each=For-each loops
|
||||
feature.varargs=Variable arity methods
|
||||
feature.hex.fp.literals=Hexadecimal floating point literals
|
||||
feature.diamond.types=Diamond types
|
||||
feature.multi.catch=Multi-catches
|
||||
feature.try.with.resources=Try-with-resources
|
||||
feature.binary.literals=Binary literals
|
||||
feature.underscores.in.literals=Underscores in literals
|
||||
feature.extension.methods=Extension methods
|
||||
feature.method.references=Method references
|
||||
feature.lambda.expressions=Lambda expressions
|
||||
feature.type.annotations=Type annotations
|
||||
feature.type.receivers=Receiver parameters
|
||||
feature.intersections.in.casts=Intersection types in casts
|
||||
feature.static.interface.calls=Static interface method calls
|
||||
feature.try.with.resources.refs=Resource references
|
||||
feature.modules=Modules
|
||||
feature.lvti=Local variable type inference
|
||||
feature.text.blocks=Text block literals
|
||||
feature.enhanced.switch=Enhanced 'switch' blocks
|
||||
feature.switch.expressions='switch' expressions
|
||||
feature.records=Records
|
||||
feature.patterns.instanceof=Patterns in 'instanceof'
|
||||
feature.text.block.escape.sequences='\\s' and '\\' escape sequences
|
||||
|
||||
find.searching.for.references.to.class.progress=Searching for references to class {0}...
|
||||
find.usages.panel.title.derived.classes=Derived Classes
|
||||
find.usages.panel.title.derived.interfaces=Derived Interfaces
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.jetbrains.annotations.PropertyKey;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class JavaAnalysisBundle extends DynamicBundle {
|
||||
@NonNls private static final String BUNDLE = "messages.JavaAnalysisBundle";
|
||||
@NonNls public static final String BUNDLE = "messages.JavaAnalysisBundle";
|
||||
private static final JavaAnalysisBundle INSTANCE = new JavaAnalysisBundle();
|
||||
|
||||
private JavaAnalysisBundle() {
|
||||
|
||||
+3
-2
@@ -10,6 +10,7 @@ import com.intellij.codeInsight.daemon.impl.quickfix.QuickFixAction;
|
||||
import com.intellij.codeInsight.intention.IntentionAction;
|
||||
import com.intellij.codeInsight.intention.QuickFixFactory;
|
||||
import com.intellij.codeInsight.intention.impl.BaseIntentionAction;
|
||||
import com.intellij.java.analysis.JavaAnalysisBundle;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -220,7 +221,7 @@ public class AnnotationsHighlightUtil {
|
||||
PsiAnnotation.TargetType[] targets = AnnotationTargetUtil.getTargetsForLocation(owner);
|
||||
PsiAnnotation.TargetType applicable = AnnotationTargetUtil.findAnnotationTarget(container, targets);
|
||||
if (applicable == null) {
|
||||
String target = JavaErrorBundle.message("annotation.target." + targets[0]);
|
||||
String target = JavaAnalysisBundle.message("annotation.target." + targets[0]);
|
||||
String message = JavaErrorBundle.message("annotation.container.not.applicable", container.getName(), target);
|
||||
return annotationError(annotationToCheck, message);
|
||||
}
|
||||
@@ -361,7 +362,7 @@ public class AnnotationsHighlightUtil {
|
||||
if (applicable == PsiAnnotation.TargetType.UNKNOWN) return null;
|
||||
|
||||
if (applicable == null) {
|
||||
String target = JavaErrorBundle.message("annotation.target." + targets[0]);
|
||||
String target = JavaAnalysisBundle.message("annotation.target." + targets[0]);
|
||||
String message = JavaErrorBundle.message("annotation.not.applicable", nameRef.getText(), target);
|
||||
return annotationError(annotation, message);
|
||||
}
|
||||
|
||||
+3
-2
@@ -15,6 +15,7 @@ import com.intellij.codeInsight.intention.IntentionAction;
|
||||
import com.intellij.codeInsight.intention.QuickFixFactory;
|
||||
import com.intellij.codeInsight.quickfix.UnresolvedReferenceQuickFixProvider;
|
||||
import com.intellij.codeInspection.LocalQuickFixOnPsiElementAsIntentionAdapter;
|
||||
import com.intellij.java.analysis.JavaAnalysisBundle;
|
||||
import com.intellij.lang.findUsages.LanguageFindUsages;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.module.EffectiveLanguageLevelUtil;
|
||||
@@ -3255,7 +3256,7 @@ public class HighlightUtil extends HighlightUtilBase {
|
||||
@PropertyKey(resourceBundle = JavaErrorBundle.BUNDLE)
|
||||
private final String key;
|
||||
|
||||
Feature(LanguageLevel level, @PropertyKey(resourceBundle = JavaErrorBundle.BUNDLE) String key) {
|
||||
Feature(LanguageLevel level, @PropertyKey(resourceBundle = JavaAnalysisBundle.BUNDLE) String key) {
|
||||
this.level = level;
|
||||
this.key = key;
|
||||
}
|
||||
@@ -3310,7 +3311,7 @@ public class HighlightUtil extends HighlightUtilBase {
|
||||
@NotNull Feature feature,
|
||||
@NotNull LanguageLevel level,
|
||||
@NotNull PsiFile file) {
|
||||
String name = JavaErrorBundle.message(feature.key);
|
||||
String name = JavaAnalysisBundle.message(feature.key);
|
||||
String version = JavaSdkVersion.fromLanguageLevel(level).getDescription();
|
||||
String message = JavaErrorBundle.message("insufficient.language.level", name, version);
|
||||
|
||||
|
||||
+32
-31
@@ -14,6 +14,7 @@ import com.intellij.codeInspection.dataFlow.types.DfType;
|
||||
import com.intellij.codeInspection.dataFlow.types.DfTypes;
|
||||
import com.intellij.codeInspection.dataFlow.value.DfaValue;
|
||||
import com.intellij.codeInspection.nullable.NullableStuffInspectionBase;
|
||||
import com.intellij.java.analysis.JavaAnalysisBundle;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -139,7 +140,7 @@ public abstract class DataFlowInspectionBase extends AbstractBaseJavaLocalInspec
|
||||
if (TypeConversionUtil.isPrimitiveWrapper(methodReturnType) && NullableNotNullManager.isNullable((PsiMethod)resolve)) {
|
||||
final PsiType returnType = LambdaUtil.getFunctionalInterfaceReturnType(expression);
|
||||
if (TypeConversionUtil.isPrimitiveAndNotNull(returnType)) {
|
||||
holder.registerProblem(expression, InspectionsBundle.message("dataflow.message.unboxing.method.reference"));
|
||||
holder.registerProblem(expression, JavaAnalysisBundle.message("dataflow.message.unboxing.method.reference"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -150,7 +151,7 @@ public abstract class DataFlowInspectionBase extends AbstractBaseJavaLocalInspec
|
||||
PsiExpression condition = PsiUtil.skipParenthesizedExprDown(statement.getCondition());
|
||||
if (BoolUtils.isBooleanLiteral(condition)) {
|
||||
LocalQuickFix fix = createSimplifyBooleanExpressionFix(condition, condition.textMatches(PsiKeyword.TRUE));
|
||||
holder.registerProblem(condition, InspectionsBundle
|
||||
holder.registerProblem(condition, JavaAnalysisBundle
|
||||
.message("dataflow.message.constant.no.ref", condition.textMatches(PsiKeyword.TRUE) ? 1 : 0), fix);
|
||||
}
|
||||
}
|
||||
@@ -173,7 +174,7 @@ public abstract class DataFlowInspectionBase extends AbstractBaseJavaLocalInspec
|
||||
private void checkLoopCondition(PsiExpression condition) {
|
||||
condition = PsiUtil.skipParenthesizedExprDown(condition);
|
||||
if (condition != null && condition.textMatches(PsiKeyword.FALSE)) {
|
||||
holder.registerProblem(condition, InspectionsBundle.message("dataflow.message.constant.no.ref", 0), createSimplifyBooleanExpressionFix(condition, false));
|
||||
holder.registerProblem(condition, JavaAnalysisBundle.message("dataflow.message.constant.no.ref", 0), createSimplifyBooleanExpressionFix(condition, false));
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -188,7 +189,7 @@ public abstract class DataFlowInspectionBase extends AbstractBaseJavaLocalInspec
|
||||
for (PsiParameter parameter : NullParameterConstraintChecker.checkMethodParameters(method)) {
|
||||
PsiIdentifier name = parameter.getNameIdentifier();
|
||||
if (name != null) {
|
||||
holder.registerProblem(name, InspectionsBundle.message("dataflow.method.fails.with.null.argument"),
|
||||
holder.registerProblem(name, JavaAnalysisBundle.message("dataflow.method.fails.with.null.argument"),
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING, createNavigateToNullParameterUsagesFix(parameter));
|
||||
}
|
||||
}
|
||||
@@ -215,15 +216,15 @@ public abstract class DataFlowInspectionBase extends AbstractBaseJavaLocalInspec
|
||||
return visitor;
|
||||
}
|
||||
|
||||
private static void reportAnalysisQualityProblem(ProblemsHolder holder, PsiElement scope, @PropertyKey(resourceBundle = InspectionsBundle.BUNDLE) String problemKey) {
|
||||
private static void reportAnalysisQualityProblem(ProblemsHolder holder, PsiElement scope, @PropertyKey(resourceBundle = JavaAnalysisBundle.BUNDLE) String problemKey) {
|
||||
PsiIdentifier name = null;
|
||||
String message = null;
|
||||
if(scope.getParent() instanceof PsiMethod) {
|
||||
name = ((PsiMethod)scope.getParent()).getNameIdentifier();
|
||||
message = InspectionsBundle.message(problemKey, "Method <code>#ref</code>");
|
||||
message = JavaAnalysisBundle.message(problemKey, "Method <code>#ref</code>");
|
||||
} else if(scope instanceof PsiClass) {
|
||||
name = ((PsiClass)scope).getNameIdentifier();
|
||||
message = InspectionsBundle.message(problemKey, "Class initializer");
|
||||
message = JavaAnalysisBundle.message(problemKey, "Class initializer");
|
||||
}
|
||||
if (name != null) { // Might be null for synthetic methods like JSP page.
|
||||
holder.registerProblem(name, message, ProblemHighlightType.WEAK_WARNING);
|
||||
@@ -294,9 +295,9 @@ public abstract class DataFlowInspectionBase extends AbstractBaseJavaLocalInspec
|
||||
}
|
||||
|
||||
reportMutabilityViolations(holder, visitor.getMutabilityViolations(true),
|
||||
InspectionsBundle.message("dataflow.message.immutable.modified"));
|
||||
JavaAnalysisBundle.message("dataflow.message.immutable.modified"));
|
||||
reportMutabilityViolations(holder, visitor.getMutabilityViolations(false),
|
||||
InspectionsBundle.message("dataflow.message.immutable.passed"));
|
||||
JavaAnalysisBundle.message("dataflow.message.immutable.passed"));
|
||||
|
||||
reportDuplicateAssignments(reporter, visitor);
|
||||
reportPointlessSameArguments(reporter, visitor);
|
||||
@@ -312,7 +313,7 @@ public abstract class DataFlowInspectionBase extends AbstractBaseJavaLocalInspec
|
||||
PsiExpression expression = instanceOf.getExpression();
|
||||
if (expression != null && !JavaPsiPatternUtil.getExposedPatternVariables(expression).isEmpty()) continue;
|
||||
reporter.registerProblem(expression,
|
||||
InspectionsBundle.message("dataflow.message.redundant.instanceof"),
|
||||
JavaAnalysisBundle.message("dataflow.message.redundant.instanceof"),
|
||||
new RedundantInstanceofFix());
|
||||
}
|
||||
}
|
||||
@@ -334,7 +335,7 @@ public abstract class DataFlowInspectionBase extends AbstractBaseJavaLocalInspec
|
||||
continue;
|
||||
}
|
||||
coveredSwitches.add(statement);
|
||||
holder.registerProblem(label, InspectionsBundle.message("dataflow.message.only.switch.label"),
|
||||
holder.registerProblem(label, JavaAnalysisBundle.message("dataflow.message.only.switch.label"),
|
||||
createUnwrapSwitchLabelFix());
|
||||
}
|
||||
for (Map.Entry<PsiExpression, ThreeState> entry : labelReachability.entrySet()) {
|
||||
@@ -342,7 +343,7 @@ public abstract class DataFlowInspectionBase extends AbstractBaseJavaLocalInspec
|
||||
PsiExpression label = entry.getKey();
|
||||
PsiSwitchLabelStatementBase labelStatement = Objects.requireNonNull(PsiImplUtil.getSwitchLabel(label));
|
||||
if (!coveredSwitches.contains(labelStatement.getEnclosingSwitchBlock())) {
|
||||
holder.registerProblem(label, InspectionsBundle.message("dataflow.message.unreachable.switch.label"),
|
||||
holder.registerProblem(label, JavaAnalysisBundle.message("dataflow.message.unreachable.switch.label"),
|
||||
new DeleteSwitchLabelFix(label));
|
||||
}
|
||||
}
|
||||
@@ -370,7 +371,7 @@ public abstract class DataFlowInspectionBase extends AbstractBaseJavaLocalInspec
|
||||
if (chunk.myRange != null) {
|
||||
if (result.value() instanceof Boolean) {
|
||||
// report rare cases like a == b == c where "a == b" part is constant
|
||||
String message = InspectionsBundle.message("dataflow.message.constant.condition",
|
||||
String message = JavaAnalysisBundle.message("dataflow.message.constant.condition",
|
||||
((Boolean)result.value()).booleanValue() ? 1 : 0);
|
||||
reporter.registerProblem(expression, chunk.myRange, message);
|
||||
// do not add to reported anchors if only part of expression was reported
|
||||
@@ -454,7 +455,7 @@ public abstract class DataFlowInspectionBase extends AbstractBaseJavaLocalInspec
|
||||
visitor.pointlessSameArguments().forEach(expr -> {
|
||||
PsiElement name = expr.getReferenceNameElement();
|
||||
if (name != null) {
|
||||
reporter.registerProblem(name, InspectionsBundle.message("dataflow.message.pointless.same.arguments"));
|
||||
reporter.registerProblem(name, JavaAnalysisBundle.message("dataflow.message.pointless.same.arguments"));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -483,8 +484,8 @@ public abstract class DataFlowInspectionBase extends AbstractBaseJavaLocalInspec
|
||||
}
|
||||
}
|
||||
String message = assignment != null && !assignment.getOperationTokenType().equals(JavaTokenType.EQ)
|
||||
? InspectionsBundle.message("dataflow.message.redundant.update")
|
||||
: InspectionsBundle.message("dataflow.message.redundant.assignment");
|
||||
? JavaAnalysisBundle.message("dataflow.message.redundant.update")
|
||||
: JavaAnalysisBundle.message("dataflow.message.redundant.assignment");
|
||||
reporter.registerProblem(expr, message, createRemoveAssignmentFix(assignment));
|
||||
});
|
||||
}
|
||||
@@ -517,7 +518,7 @@ public abstract class DataFlowInspectionBase extends AbstractBaseJavaLocalInspec
|
||||
.registerProblem(getElementToHighlight(newExpression), problem.getMessage(expressions), fixes.toArray(LocalQuickFix.EMPTY_ARRAY));
|
||||
});
|
||||
NullabilityProblemKind.callMethodRefNPE.ifMyProblem(problem, methodRef ->
|
||||
reporter.registerProblem(methodRef, InspectionsBundle.message("dataflow.message.npe.methodref.invocation"),
|
||||
reporter.registerProblem(methodRef, JavaAnalysisBundle.message("dataflow.message.npe.methodref.invocation"),
|
||||
createMethodReferenceNPEFixes(methodRef, reporter.isOnTheFly()).toArray(LocalQuickFix.EMPTY_ARRAY)));
|
||||
NullabilityProblemKind.callNPE.ifMyProblem(problem, call -> reportCallMayProduceNpe(reporter, problem.getMessage(expressions), call));
|
||||
NullabilityProblemKind.passingToNotNullParameter.ifMyProblem(problem, expr -> {
|
||||
@@ -526,7 +527,7 @@ public abstract class DataFlowInspectionBase extends AbstractBaseJavaLocalInspec
|
||||
});
|
||||
NullabilityProblemKind.passingToNotNullMethodRefParameter.ifMyProblem(problem, methodRef -> {
|
||||
LocalQuickFix[] fixes = createMethodReferenceNPEFixes(methodRef, reporter.isOnTheFly()).toArray(LocalQuickFix.EMPTY_ARRAY);
|
||||
reporter.registerProblem(methodRef, InspectionsBundle.message("dataflow.message.passing.nullable.argument.methodref"), fixes);
|
||||
reporter.registerProblem(methodRef, JavaAnalysisBundle.message("dataflow.message.passing.nullable.argument.methodref"), fixes);
|
||||
});
|
||||
NullabilityProblemKind.arrayAccessNPE.ifMyProblem(problem, arrayAccess -> {
|
||||
LocalQuickFix[] fixes =
|
||||
@@ -574,14 +575,14 @@ public abstract class DataFlowInspectionBase extends AbstractBaseJavaLocalInspec
|
||||
visitor.outOfBoundsArrayAccesses().forEach(access -> {
|
||||
PsiExpression indexExpression = access.getIndexExpression();
|
||||
if (indexExpression != null) {
|
||||
holder.registerProblem(indexExpression, InspectionsBundle.message("dataflow.message.array.index.out.of.bounds"));
|
||||
holder.registerProblem(indexExpression, JavaAnalysisBundle.message("dataflow.message.array.index.out.of.bounds"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void reportArrayStoreProblems(ProblemsHolder holder, DataFlowInstructionVisitor visitor) {
|
||||
visitor.getArrayStoreProblems().forEach(
|
||||
(assignment, types) -> holder.registerProblem(assignment.getOperationSign(), InspectionsBundle
|
||||
(assignment, types) -> holder.registerProblem(assignment.getOperationSign(), JavaAnalysisBundle
|
||||
.message("dataflow.message.arraystore", types.getFirst().getCanonicalText(), types.getSecond().getCanonicalText())));
|
||||
}
|
||||
|
||||
@@ -589,7 +590,7 @@ public abstract class DataFlowInspectionBase extends AbstractBaseJavaLocalInspec
|
||||
visitor.getMethodReferenceResults().forEach((methodRef, result) -> {
|
||||
if (result != ConstantResult.UNKNOWN) {
|
||||
Object value = result.value();
|
||||
holder.registerProblem(methodRef, InspectionsBundle.message("dataflow.message.constant.method.reference", value),
|
||||
holder.registerProblem(methodRef, JavaAnalysisBundle.message("dataflow.message.constant.method.reference", value),
|
||||
createReplaceWithTrivialLambdaFix(value));
|
||||
}
|
||||
});
|
||||
@@ -636,9 +637,9 @@ public abstract class DataFlowInspectionBase extends AbstractBaseJavaLocalInspec
|
||||
|
||||
private static @NotNull String getContractMessage(List<? extends MethodContract> contracts) {
|
||||
if (contracts.stream().allMatch(mc -> mc.getConditions().stream().allMatch(ContractValue::isBoundCheckingCondition))) {
|
||||
return InspectionsBundle.message("dataflow.message.contract.fail.index");
|
||||
return JavaAnalysisBundle.message("dataflow.message.contract.fail.index");
|
||||
}
|
||||
return InspectionsBundle.message("dataflow.message.contract.fail");
|
||||
return JavaAnalysisBundle.message("dataflow.message.contract.fail");
|
||||
}
|
||||
|
||||
private static @NotNull PsiElement getElementToHighlight(@NotNull PsiCall call) {
|
||||
@@ -731,8 +732,8 @@ public abstract class DataFlowInspectionBase extends AbstractBaseJavaLocalInspec
|
||||
}
|
||||
String text = PsiExpressionTrimRenderer.render(operand);
|
||||
String message = alwaysFails ?
|
||||
InspectionsBundle.message("dataflow.message.cce.always", text) :
|
||||
InspectionsBundle.message("dataflow.message.cce", text);
|
||||
JavaAnalysisBundle.message("dataflow.message.cce.always", text) :
|
||||
JavaAnalysisBundle.message("dataflow.message.cce", text);
|
||||
reporter.registerProblem(castType, message, fixes.toArray(LocalQuickFix.EMPTY_ARRAY));
|
||||
});
|
||||
}
|
||||
@@ -750,7 +751,7 @@ public abstract class DataFlowInspectionBase extends AbstractBaseJavaLocalInspec
|
||||
PsiTreeUtil.isAncestor(((PsiAssignmentExpression)parent).getLExpression(), psiAnchor, false)) {
|
||||
reporter.registerProblem(
|
||||
psiAnchor,
|
||||
InspectionsBundle.message("dataflow.message.pointless.assignment.expression", Boolean.toString(evaluatesToTrue)),
|
||||
JavaAnalysisBundle.message("dataflow.message.pointless.assignment.expression", Boolean.toString(evaluatesToTrue)),
|
||||
createConditionalAssignmentFixes(evaluatesToTrue, (PsiAssignmentExpression)parent, reporter.isOnTheFly())
|
||||
);
|
||||
return;
|
||||
@@ -769,7 +770,7 @@ public abstract class DataFlowInspectionBase extends AbstractBaseJavaLocalInspec
|
||||
ContainerUtil.addIfNotNull(fixes, createExplainFix(
|
||||
(PsiExpression)psiAnchor, new TrackingRunner.ValueDfaProblemType(evaluatesToTrue)));
|
||||
}
|
||||
String message = InspectionsBundle.message(isAtRHSOfBooleanAnd(psiAnchor) ?
|
||||
String message = JavaAnalysisBundle.message(isAtRHSOfBooleanAnd(psiAnchor) ?
|
||||
"dataflow.message.constant.condition.when.reached" :
|
||||
"dataflow.message.constant.condition", evaluatesToTrue ? 1 : 0);
|
||||
reporter.registerProblem(psiAnchor, message, fixes.toArray(LocalQuickFix.EMPTY_ARRAY));
|
||||
@@ -907,16 +908,16 @@ public abstract class DataFlowInspectionBase extends AbstractBaseJavaLocalInspec
|
||||
if (nullability == Nullability.NOT_NULL) {
|
||||
String presentable = NullableStuffInspectionBase.getPresentableAnnoName(anno);
|
||||
final String text = exactlyNull
|
||||
? InspectionsBundle.message("dataflow.message.return.null.from.notnull", presentable)
|
||||
: InspectionsBundle.message("dataflow.message.return.nullable.from.notnull", presentable);
|
||||
? JavaAnalysisBundle.message("dataflow.message.return.null.from.notnull", presentable)
|
||||
: JavaAnalysisBundle.message("dataflow.message.return.nullable.from.notnull", presentable);
|
||||
reporter.registerProblem(expr, text, createNPEFixes(expr, expr, reporter.isOnTheFly()).toArray(LocalQuickFix.EMPTY_ARRAY));
|
||||
}
|
||||
else if (AnnotationUtil.isAnnotatingApplicable(anchor)) {
|
||||
final String defaultNullable = manager.getDefaultNullable();
|
||||
final String presentableNullable = StringUtil.getShortName(defaultNullable);
|
||||
final String text = exactlyNull
|
||||
? InspectionsBundle.message("dataflow.message.return.null.from.notnullable", presentableNullable)
|
||||
: InspectionsBundle.message("dataflow.message.return.nullable.from.notnullable", presentableNullable);
|
||||
? JavaAnalysisBundle.message("dataflow.message.return.null.from.notnullable", presentableNullable)
|
||||
: JavaAnalysisBundle.message("dataflow.message.return.nullable.from.notnullable", presentableNullable);
|
||||
final LocalQuickFix[] fixes =
|
||||
PsiTreeUtil.getParentOfType(anchor, PsiMethod.class, PsiLambdaExpression.class) instanceof PsiLambdaExpression
|
||||
? LocalQuickFix.EMPTY_ARRAY
|
||||
|
||||
+4
-3
@@ -3,6 +3,7 @@ package com.intellij.codeInspection.dataFlow;
|
||||
|
||||
import com.intellij.codeInsight.Nullability;
|
||||
import com.intellij.codeInspection.InspectionsBundle;
|
||||
import com.intellij.java.analysis.JavaAnalysisBundle;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.util.PsiTypesUtil;
|
||||
@@ -22,7 +23,7 @@ import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
import static com.intellij.codeInspection.InspectionsBundle.BUNDLE;
|
||||
import static com.intellij.java.analysis.JavaAnalysisBundle.BUNDLE;
|
||||
import static com.intellij.psi.CommonClassNames.JAVA_LANG_NULL_POINTER_EXCEPTION;
|
||||
import static com.intellij.psi.CommonClassNames.JAVA_LANG_RUNTIME_EXCEPTION;
|
||||
import static com.intellij.util.ObjectUtils.tryCast;
|
||||
@@ -57,8 +58,8 @@ public class NullabilityProblemKind<T extends PsiElement> {
|
||||
@NotNull @PropertyKey(resourceBundle = BUNDLE) String normalMessage) {
|
||||
myException = exception;
|
||||
myName = name;
|
||||
myAlwaysNullMessage = InspectionsBundle.message(alwaysNullMessage);
|
||||
myNormalMessage = InspectionsBundle.message(normalMessage);
|
||||
myAlwaysNullMessage = JavaAnalysisBundle.message(alwaysNullMessage);
|
||||
myNormalMessage = JavaAnalysisBundle.message(normalMessage);
|
||||
}
|
||||
|
||||
public static final NullabilityProblemKind<PsiMethodCallExpression> callNPE =
|
||||
|
||||
@@ -35,32 +35,6 @@ receiver.wrong.position=The receiver should be the first parameter
|
||||
receiver.type.mismatch=The receiver type does not match the enclosing class type
|
||||
receiver.name.mismatch=The receiver name does not match the enclosing class type
|
||||
|
||||
# These aren't unused.
|
||||
# suppress inspection "UnusedProperty"
|
||||
annotation.target.ANNOTATION_TYPE=annotation type
|
||||
# suppress inspection "UnusedProperty"
|
||||
annotation.target.TYPE=type
|
||||
# suppress inspection "UnusedProperty"
|
||||
annotation.target.TYPE_USE=type use
|
||||
# suppress inspection "UnusedProperty"
|
||||
annotation.target.TYPE_PARAMETER=type parameter
|
||||
# suppress inspection "UnusedProperty"
|
||||
annotation.target.CONSTRUCTOR=constructor
|
||||
# suppress inspection "UnusedProperty"
|
||||
annotation.target.METHOD=method
|
||||
# suppress inspection "UnusedProperty"
|
||||
annotation.target.FIELD=field
|
||||
# suppress inspection "UnusedProperty"
|
||||
annotation.target.PARAMETER=parameter
|
||||
# suppress inspection "UnusedProperty"
|
||||
annotation.target.LOCAL_VARIABLE=local variable
|
||||
# suppress inspection "UnusedProperty"
|
||||
annotation.target.PACKAGE=package
|
||||
# suppress inspection "UnusedProperty"
|
||||
annotation.target.MODULE=module
|
||||
# suppress inspection "UnusedProperty"
|
||||
annotation.target.RECORD_COMPONENT=record component
|
||||
|
||||
# generics related messages
|
||||
generics.holder.type=Type
|
||||
generics.holder.method=Method
|
||||
@@ -455,31 +429,4 @@ record.component.not.initialized=Record component ''{0}'' might not be initializ
|
||||
compact.constructor.in.regular.class=Parameter list expected
|
||||
record.compact.constructor.return='return' statement is not allowed in compact constructor
|
||||
|
||||
feature.generics=Generics
|
||||
feature.annotations=Annotations
|
||||
feature.static.imports=Static imports
|
||||
feature.for.each=For-each loops
|
||||
feature.varargs=Variable arity methods
|
||||
feature.hex.fp.literals=Hexadecimal floating point literals
|
||||
feature.diamond.types=Diamond types
|
||||
feature.multi.catch=Multi-catches
|
||||
feature.try.with.resources=Try-with-resources
|
||||
feature.binary.literals=Binary literals
|
||||
feature.underscores.in.literals=Underscores in literals
|
||||
feature.extension.methods=Extension methods
|
||||
feature.method.references=Method references
|
||||
feature.lambda.expressions=Lambda expressions
|
||||
feature.type.annotations=Type annotations
|
||||
feature.type.receivers=Receiver parameters
|
||||
feature.intersections.in.casts=Intersection types in casts
|
||||
feature.static.interface.calls=Static interface method calls
|
||||
feature.try.with.resources.refs=Resource references
|
||||
feature.modules=Modules
|
||||
feature.lvti=Local variable type inference
|
||||
feature.text.blocks=Text block literals
|
||||
feature.enhanced.switch=Enhanced 'switch' blocks
|
||||
feature.switch.expressions='switch' expressions
|
||||
feature.records=Records
|
||||
feature.patterns.instanceof=Patterns in 'instanceof'
|
||||
feature.text.block.escape.sequences='\\s' and '\\' escape sequences
|
||||
insufficient.language.level={0} are not supported at language level ''{1}''
|
||||
|
||||
@@ -48,57 +48,6 @@ inspection.data.flow.use.computeifpresent.quickfix=Replace 'compute' with 'compu
|
||||
configure.annotations.option=Configure Annotations
|
||||
|
||||
#messages from dataflow inspection
|
||||
dataflow.message.npe.method.invocation=Method invocation <code>#ref</code> #loc may produce <code>NullPointerException</code>
|
||||
dataflow.message.npe.method.invocation.sure=Method invocation <code>#ref</code> #loc will produce <code>NullPointerException</code>
|
||||
dataflow.message.npe.inner.class.construction=Inner class construction may produce <code>NullPointerException</code>
|
||||
dataflow.message.npe.inner.class.construction.sure=Inner class construction will produce <code>NullPointerException</code>
|
||||
dataflow.message.npe.methodref.invocation=Method reference invocation <code>#ref</code> #loc may produce <code>NullPointerException</code>
|
||||
dataflow.message.npe.array.access=Array access <code>#ref</code> #loc may produce <code>NullPointerException</code>
|
||||
dataflow.message.npe.array.access.sure=Array access <code>#ref</code> #loc will produce <code>NullPointerException</code>
|
||||
dataflow.message.npe.field.access.sure=Dereference of <code>#ref</code> #loc will produce <code>NullPointerException</code>
|
||||
dataflow.message.npe.field.access=Dereference of <code>#ref</code> #loc may produce <code>NullPointerException</code>
|
||||
dataflow.message.cce=Casting <code>{0}</code> to <code>#ref</code> #loc may produce <code>ClassCastException</code>
|
||||
dataflow.message.cce.always=Casting <code>{0}</code> to <code>#ref</code> #loc will produce <code>ClassCastException</code> for any non-null value
|
||||
dataflow.message.arraystore=Storing element of type <code>{0}</code> to array of <code>{1}</code> elements may produce <code>ArrayStoreException</code>
|
||||
dataflow.message.redundant.instanceof=Condition <code>#ref</code> #loc is redundant and can be replaced with a null check
|
||||
dataflow.message.contract.fail=The call to '#ref' always fails, according to its method contracts
|
||||
dataflow.message.contract.fail.index=The call to '#ref' always fails as index is out of bounds
|
||||
dataflow.message.constant.condition=Condition <code>#ref</code> #loc is always <code>{0, choice, 0#false|1#true}</code>
|
||||
dataflow.message.constant.condition.when.reached=Condition <code>#ref</code> #loc is always <code>{0, choice, 0#false|1#true}</code> when reached
|
||||
dataflow.message.constant.no.ref=Condition is always {0, choice, 0#false|1#true}
|
||||
dataflow.message.unreachable.switch.label=Switch label <code>#ref</code> #loc is unreachable
|
||||
dataflow.message.only.switch.label=Switch label <code>#ref</code> #loc is the only reachable in the whole switch
|
||||
dataflow.message.pointless.assignment.expression=Condition <code>#ref</code> #loc at the left side of assignment expression is always <code>{0}</code>. Can be simplified
|
||||
dataflow.message.passing.null.argument=Passing <code>null</code> argument to parameter annotated as @NotNull
|
||||
dataflow.message.passing.nullable.argument=Argument <code>#ref</code> #loc might be null
|
||||
dataflow.message.passing.nullable.argument.methodref=Method reference argument might be null
|
||||
dataflow.message.passing.null.argument.nonannotated=Passing <code>null</code> argument to non-annotated parameter
|
||||
dataflow.message.passing.nullable.argument.nonannotated=Argument <code>#ref</code> #loc might be null but passed to non-annotated parameter
|
||||
dataflow.message.passing.nullable.argument.methodref.nonannotated=Method reference argument might be null but passed to non-annotated parameter
|
||||
dataflow.message.assigning.null=<code>null</code> is assigned to a variable that is annotated with @NotNull
|
||||
dataflow.message.assigning.nullable=Expression <code>#ref</code> might evaluate to null but is assigned to a variable that is annotated with @NotNull
|
||||
dataflow.message.assigning.null.notannotated=Assigning <code>null</code> value to non-annotated field
|
||||
dataflow.message.assigning.nullable.notannotated=Expression <code>#ref</code> #loc might be null but is assigned to non-annotated field
|
||||
dataflow.message.storing.array.null=<code>null</code> is stored to an array of @NotNull elements
|
||||
dataflow.message.storing.array.nullable=Expression <code>#ref</code> might evaluate to null but is stored to an array of @NotNull elements
|
||||
dataflow.message.return.null.from.notnull=<code>null</code> is returned by the method declared as @{0}
|
||||
dataflow.message.return.nullable.from.notnull=Expression <code>#ref</code> might evaluate to null but is returned by the method declared as @{0}
|
||||
dataflow.message.return.null.from.notnullable=<code>null</code> is returned by the method which is not declared as @{0}
|
||||
dataflow.message.return.nullable.from.notnullable=Expression <code>#ref</code> might evaluate to null but is returned by the method which is not declared as @{0}
|
||||
dataflow.message.return.nullable.from.notnull.function=Function may return null, but it's not allowed here
|
||||
dataflow.message.unboxing=Unboxing of <code>#ref</code> #loc may produce <code>NullPointerException</code>
|
||||
dataflow.message.unboxing.method.reference=Use of <code>#ref</code> #loc would need unboxing which may produce <code>NullPointerException</code>
|
||||
dataflow.too.complex={0} is too complex to analyze by data flow algorithm
|
||||
dataflow.not.precise={0} is complex: data flow results could be imprecise
|
||||
dataflow.method.fails.with.null.argument=Method will throw an exception when parameter is null
|
||||
dataflow.message.constant.method.reference=Method reference result is always ''{0}''
|
||||
dataflow.message.array.index.out.of.bounds=Array index is out of bounds
|
||||
dataflow.message.immutable.modified=Immutable object is modified
|
||||
dataflow.message.immutable.passed=Immutable object is passed where mutable is expected
|
||||
dataflow.message.redundant.update=Variable update does nothing
|
||||
dataflow.message.redundant.assignment=Variable is already assigned to this value
|
||||
dataflow.message.pointless.same.arguments=Arguments of '#ref' are the same. Calling this method with the same arguments is meaningless.
|
||||
|
||||
inspection.optional.get.without.is.present.message=<code>{0}.#ref()</code> without ''isPresent()'' check
|
||||
|
||||
#deprecated
|
||||
|
||||
+2
-1
@@ -2,6 +2,7 @@
|
||||
package org.jetbrains.plugins.groovy.annotator.checkers;
|
||||
|
||||
import com.intellij.codeInsight.daemon.JavaErrorBundle;
|
||||
import com.intellij.java.analysis.JavaAnalysisBundle;
|
||||
import com.intellij.lang.annotation.AnnotationHolder;
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
@@ -43,7 +44,7 @@ public abstract class CustomAnnotationChecker {
|
||||
PsiElement ownerToUse = owner instanceof PsiModifierList ? ((PsiElement)owner).getParent() : (PsiElement)owner;
|
||||
PsiAnnotation.TargetType[] elementTypeFields = GrAnnotationImpl.getApplicableElementTypeFields(ownerToUse);
|
||||
if (elementTypeFields.length != 0 && !GrAnnotationImpl.isAnnotationApplicableTo(annotation, elementTypeFields)) {
|
||||
String annotationTargetText = JavaErrorBundle.message("annotation.target." + elementTypeFields[0]);
|
||||
String annotationTargetText = JavaAnalysisBundle.message("annotation.target." + elementTypeFields[0]);
|
||||
GrCodeReferenceElement ref = annotation.getClassReference();
|
||||
return JavaErrorBundle.message("annotation.not.applicable", ref.getText(), annotationTargetText);
|
||||
}
|
||||
|
||||
+2
-1
@@ -16,6 +16,7 @@
|
||||
package org.jetbrains.plugins.groovy.annotator.checkers;
|
||||
|
||||
import com.intellij.codeInsight.daemon.JavaErrorBundle;
|
||||
import com.intellij.java.analysis.JavaAnalysisBundle;
|
||||
import com.intellij.lang.annotation.AnnotationHolder;
|
||||
import com.intellij.lang.annotation.HighlightSeverity;
|
||||
import com.intellij.psi.PsiAnnotation;
|
||||
@@ -60,7 +61,7 @@ public class FieldAnnotationChecker extends CustomAnnotationChecker {
|
||||
|
||||
if (!GrAnnotationImpl.isAnnotationApplicableTo(annotation, PsiAnnotation.TargetType.LOCAL_VARIABLE)) {
|
||||
GrCodeReferenceElement ref = annotation.getClassReference();
|
||||
String target = JavaErrorBundle.message("annotation.target.LOCAL_VARIABLE");
|
||||
String target = JavaAnalysisBundle.message("annotation.target.LOCAL_VARIABLE");
|
||||
String description = JavaErrorBundle.message("annotation.not.applicable", ref.getText(), target);
|
||||
holder.newAnnotation(HighlightSeverity.ERROR, description).range(ref).create();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user