fix inspection message strangeness

GitOrigin-RevId: 12db0098047932e92ac468072095492cb558adea
This commit is contained in:
Bas Leijdekkers
2022-03-20 19:35:18 +00:00
committed by intellij-monorepo-bot
parent 62d5b9bc4d
commit 601902f5eb
18 changed files with 70 additions and 74 deletions
@@ -295,7 +295,7 @@ inspection.nullable.problems.at.local.variable=Nullability annotation is not app
inspection.nullable.problems.at.type.parameter=Nullability annotation is not applicable to type parameters
inspection.nullable.problems.at.reference.list=Nullability annotation is not applicable to extends/implements clause
inspection.objects.equals.can.be.simplified.display.name='Objects.equals()' can be replaced with 'equals()'
inspection.redundant.cast.problem.descriptor=Casting {0} to {1} is redundant
inspection.redundant.cast.problem.descriptor=Casting <code>{0}</code> to <code>#ref</code> #loc is redundant
inspection.redundant.cast.remove.quickfix=Remove redundant cast(s)
inspection.redundant.field.initialization.option=Only warn on initialization to null
inspection.redundant.requires.statement.description=Redundant directive ''requires {0}''
@@ -414,9 +414,9 @@ inspection.java.9.redundant.requires.statement.display.name=Redundant 'requires'
inspection.numeric.overflow.display.name=Numeric overflow
inspection.redundant.cast.display.name=Redundant type cast
inspection.deprecated.is.still.used.display.name=Deprecated member is still used
inspection.message.scheduled.for.removal.annotation.can.be.replaced.by.attribute=@ScheduledForRemoval annotation can be replaced with 'forRemoval' attribute in @Deprecated annotation
inspection.message.scheduled.for.removal.annotation.can.be.replaced.by.attribute=@ScheduledForRemoval annotation can be replaced with 'forRemoval' attribute in @Deprecated annotation
inspection.message.scheduled.for.removal.annotation.can.be.removed=@ScheduledForRemoval annotation can be removed
inspection.fix.name.remove.scheduled.for.removal.annotation.by.attribute=Replace @ScheduledForRemoval with 'forRemoval' attribute in @Deprecated annotation
inspection.fix.name.remove.scheduled.for.removal.annotation.by.attribute=Replace @ScheduledForRemoval with 'forRemoval' attribute in @Deprecated annotation
inspection.name.redundant.scheduled.for.removal.annotation=Redundant @ScheduledForRemoval annotation
inspection.deprecated.class.usage.inspection.display.name=Deprecated API usage in XML
inspection.field.access.not.guarded.display.name=Unguarded field access or method call
@@ -459,7 +459,7 @@ contract.return.validator.not.applicable.static=not applicable for static method
contract.return.validator.not.applicable.primitive=not applicable for primitive return type ''{0}''
contract.return.validator.return.type.must.be.boolean=method return type must be 'boolean'
contract.return.validator.method.return.incompatible.with.method.containing.class=method return type should be compatible with method containing class
contract.return.validator.too.few.parameters=not applicable for method that has {0, choice, 0#no parameters|1#one parameter|2#{0} parameters}
contract.return.validator.too.few.parameters=not applicable for method that has {0, choice, 0#no parameters|1#one parameter|2#{0} parameters}
contract.return.validator.incompatible.return.parameter.type=return type ''{0}'' must be convertible from parameter type ''{1}''
contract.return.value.validation.prefix=Contract return value ''{0}'':
suspicious.invocation.handler.implementation.display.name=Suspicious 'InvocationHandler' implementation
@@ -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.redundantCast;
import com.intellij.codeInspection.*;
@@ -77,8 +77,7 @@ public class RedundantCastInspection extends AbstractBaseJavaLocalInspectionTool
}
}
String message = JavaAnalysisBundle.message("inspection.redundant.cast.problem.descriptor",
"<code>" + PsiExpressionTrimRenderer.render(operand) + "</code>", "<code>#ref</code> #loc");
String message = JavaAnalysisBundle.message("inspection.redundant.cast.problem.descriptor", PsiExpressionTrimRenderer.render(operand));
return manager.createProblemDescriptor(castType, message, myQuickFixAction, ProblemHighlightType.LIKE_UNUSED_SYMBOL, onTheFly);
}
@@ -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.intellij.codeInspection.defUse;
import com.intellij.codeInsight.ExpressionUtil;
@@ -98,8 +98,7 @@ public class DefUseInspection extends AbstractBaseJavaLocalInspectionTool {
else {
if (context instanceof PsiPrefixExpression && REPORT_PREFIX_EXPRESSIONS ||
context instanceof PsiPostfixExpression && REPORT_POSTFIX_EXPRESSIONS) {
holder.registerProblem(context,
JavaBundle.message("inspection.unused.assignment.problem.descriptor4", "<code>#ref</code> #loc"));
holder.registerProblem(context, JavaBundle.message("inspection.unused.assignment.problem.descriptor4"));
}
}
}
@@ -124,7 +123,7 @@ public class DefUseInspection extends AbstractBaseJavaLocalInspectionTool {
PsiElement parent = PsiUtil.skipParenthesizedExprUp(lExpression.getParent());
if (parent instanceof PsiPrefixExpression && REPORT_PREFIX_EXPRESSIONS ||
parent instanceof PsiPostfixExpression && REPORT_POSTFIX_EXPRESSIONS) {
holder.registerProblem(parent, JavaBundle.message("inspection.unused.assignment.problem.descriptor4", "<code>#ref</code> #loc"));
holder.registerProblem(parent, JavaBundle.message("inspection.unused.assignment.problem.descriptor4"));
}
else if (parent instanceof PsiAssignmentExpression) {
if (expression instanceof PsiArrayInitializerExpression ||
@@ -142,8 +141,7 @@ public class DefUseInspection extends AbstractBaseJavaLocalInspectionTool {
List<LocalQuickFix> fixes = ContainerUtil.createMaybeSingletonList(
isOnTheFlyOrNoSideEffects(holder.isOnTheFly(), psiVariable, psiVariable.getInitializer()) ? new RemoveInitializerFix() : null);
holder.registerProblem(ObjectUtils.notNull(psiVariable.getInitializer(), psiVariable),
JavaBundle.message("inspection.unused.assignment.problem.descriptor2",
"<code>" + psiVariable.getName() + "</code>", "<code>#ref</code> #loc"),
JavaBundle.message("inspection.unused.assignment.problem.descriptor2", psiVariable.getName()),
ProblemHighlightType.LIKE_UNUSED_SYMBOL,
fixes.toArray(LocalQuickFix.EMPTY_ARRAY)
);
@@ -156,7 +154,7 @@ public class DefUseInspection extends AbstractBaseJavaLocalInspectionTool {
isOnTheFlyOrNoSideEffects(holder.isOnTheFly(), psiVariable, assignment.getRExpression()) ? new RemoveAssignmentFix() : null);
holder.registerProblem(assignment.getLExpression(),
JavaBundle.message("inspection.unused.assignment.problem.descriptor3",
Objects.requireNonNull(assignment.getRExpression()).getText(), "<code>#ref</code>" + " #loc"),
Objects.requireNonNull(assignment.getRExpression()).getText()),
ProblemHighlightType.LIKE_UNUSED_SYMBOL, fixes.toArray(LocalQuickFix.EMPTY_ARRAY)
);
}
@@ -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.deadCode;
import com.intellij.analysis.AnalysisScope;
@@ -106,7 +106,7 @@ public final class UnusedDeclarationInspection extends UnusedDeclarationInspecti
@Nullable
@Override
public QuickFix getQuickFix(String hint) {
public LocalQuickFix getQuickFix(String hint) {
return myUnusedParameters.getQuickFix(hint);
}
@@ -337,8 +337,7 @@ public final class UnusedDeclarationInspection extends UnusedDeclarationInspecti
private ProblemDescriptor createProblemDescriptor(PsiVariable psiVariable) {
PsiElement toHighlight = ObjectUtils.notNull(psiVariable.getNameIdentifier(), psiVariable);
return myInspectionManager.createProblemDescriptor(
toHighlight,
JavaBundle.message("inspection.unused.assignment.problem.descriptor1", "<code>#ref</code> #loc"), (LocalQuickFix)null,
toHighlight, JavaBundle.message("inspection.unused.assignment.problem.descriptor1"), (LocalQuickFix)null,
ProblemHighlightType.LIKE_UNUSED_SYMBOL, false);
}
}
@@ -2,7 +2,7 @@ class C {
static boolean b = System.getProperty("foo") != null;
static class C1 {
{ <warning descr="The value \"a\" assigned to 's' is never used">s</warning> = "a"; }
{ <warning descr="The value '\"a\"' assigned to 's' is never used">s</warning> = "a"; }
String s = "b";
}
static class C2 {
@@ -10,12 +10,12 @@ class C {
{ s = "c"; }
}
static class C3 {
{ <warning descr="The value \"a\" assigned to 's' is never used">s</warning> = "a"; }
{ <warning descr="The value '\"a\"' assigned to 's' is never used">s</warning> = "a"; }
String s;
{ s = "c"; }
}
static class C4 {
{ if (b) <warning descr="The value \"a\" assigned to 's' is never used">s</warning> = "a"; }
{ if (b) <warning descr="The value '\"a\"' assigned to 's' is never used">s</warning> = "a"; }
String s = "b";
}
static class C5 {
@@ -37,8 +37,8 @@ class C {
static class C9 {
String s;
{
<warning descr="The value \"b\" assigned to 's' is never used">s</warning> = "b";
if (b) <warning descr="The value \"c\" assigned to 's' is never used">s</warning> = "c";
<warning descr="The value '\"b\"' assigned to 's' is never used">s</warning> = "b";
if (b) <warning descr="The value '\"c\"' assigned to 's' is never used">s</warning> = "c";
}
{ s = "d"; }
}
@@ -63,17 +63,17 @@ class C {
}
static class C14 {
String s = <warning descr="Variable 's' initializer '\"a\"' is redundant">"a"</warning>;
{ <warning descr="The value \"b\" assigned to 's' is never used">s</warning> = "b"; }
{ <warning descr="The value '\"b\"' assigned to 's' is never used">s</warning> = "b"; }
C14() { s = "c"; }
}
static class C15 {
C15() { s = "c"; }
{ if (b) <warning descr="The value \"b\" assigned to 's' is never used">s</warning> = "b"; }
{ if (b) <warning descr="The value '\"b\"' assigned to 's' is never used">s</warning> = "b"; }
String s = <warning descr="Variable 's' initializer '\"a\"' is redundant">"a"</warning>;
}
static class S1 {
static { <warning descr="The value \"a\" assigned to 's' is never used">s</warning> = "a"; }
static { <warning descr="The value '\"a\"' assigned to 's' is never used">s</warning> = "a"; }
static String s = "b";
}
static class S2 {
@@ -81,12 +81,12 @@ class C {
static { s = "c"; }
}
static class S3 {
static { <warning descr="The value \"a\" assigned to 's' is never used">s</warning> = "a"; }
static { <warning descr="The value '\"a\"' assigned to 's' is never used">s</warning> = "a"; }
static String s;
static { s = "c"; }
}
static class S4 {
static { if (b) <warning descr="The value \"a\" assigned to 's' is never used">s</warning> = "a"; }
static { if (b) <warning descr="The value '\"a\"' assigned to 's' is never used">s</warning> = "a"; }
static String s = "b";
}
static class S5 {
@@ -108,8 +108,8 @@ class C {
static class S9 {
static String s;
static {
<warning descr="The value \"b\" assigned to 's' is never used">s</warning> = "b";
if (b) <warning descr="The value \"c\" assigned to 's' is never used">s</warning> = "c";
<warning descr="The value '\"b\"' assigned to 's' is never used">s</warning> = "b";
if (b) <warning descr="The value '\"c\"' assigned to 's' is never used">s</warning> = "c";
}
static { s = "d"; }
}
@@ -4,7 +4,7 @@ public class FieldOverwrite {
int[] data;
public FieldOverwrite(int field) {
<warning descr="The value 123 assigned to 'this.val' is never used">this.val</warning> = 123;
<warning descr="The value '123' assigned to 'this.val' is never used">this.val</warning> = 123;
this.val = field;
}
@@ -15,7 +15,7 @@ public class FieldOverwrite {
void increment() {
<warning descr="The value changed at 'val++' is never used">val++</warning>;
val=2;
<warning descr="The value 3 assigned to 'val' is never used">val</warning>+=3;
<warning descr="The value '3' assigned to 'val' is never used">val</warning>+=3;
val=4;
}
@@ -33,14 +33,14 @@ public class FieldOverwrite {
}
void noUseInlining() {
<warning descr="The value 1 assigned to 'val2' is never used">val2</warning> = 1;
<warning descr="The value '1' assigned to 'val2' is never used">val2</warning> = 1;
val2 = getVal();
}
void test(FieldOverwrite fo) {
<warning descr="The value 1 assigned to 'val' is never used">val</warning> = 1;
<warning descr="The value '1' assigned to 'val' is never used">val</warning> = 1;
val = 2;
<warning descr="The value 3 assigned to 'fo.val' is never used">fo.val</warning> = 3;
<warning descr="The value '3' assigned to 'fo.val' is never used">fo.val</warning> = 3;
fo.val = 4;
}
@@ -2,10 +2,10 @@ class C {
int f(boolean b) {
int i;
if (b) {
<warning descr="The value 1 assigned to 'i' is never used">i</warning> = 1;
<warning descr="The value '1' assigned to 'i' is never used">i</warning> = 1;
}
else {
<warning descr="The value 2 assigned to 'i' is never used">i</warning> = 2;
<warning descr="The value '2' assigned to 'i' is never used">i</warning> = 2;
}
i = 3;
return i;
@@ -13,7 +13,7 @@ class C {
public void test(UUID id) {
Entity entity = repo.load(id);
try {
<warning descr="The value repo.save(entity) assigned to 'entity' is never used">entity</warning> = repo.save(entity);
<warning descr="The value 'repo.save(entity)' assigned to 'entity' is never used">entity</warning> = repo.save(entity);
} catch (RuntimeException e) {
System.out.println("failed to save entity: " + entity);
}
@@ -2,15 +2,15 @@ class C {
int f() {
int i = <warning descr="Variable 'i' initializer '0' is redundant">0</warning>;
try {
<warning descr="The value 1 assigned to 'i' is never used">i</warning> = 1;
<warning descr="The value '1' assigned to 'i' is never used">i</warning> = 1;
}
finally {
<warning descr="The value 2 assigned to 'i' is never used">i</warning> = 2;
<warning descr="The value '2' assigned to 'i' is never used">i</warning> = 2;
try {
<warning descr="The value 3 assigned to 'i' is never used">i</warning> = 3;
<warning descr="The value '3' assigned to 'i' is never used">i</warning> = 3;
}
finally {
<warning descr="The value 4 assigned to 'i' is never used">i</warning> = 4;
<warning descr="The value '4' assigned to 'i' is never used">i</warning> = 4;
}
i = 5;
}
@@ -3,7 +3,7 @@ class C {
int i;
try {
} finally {
<warning descr="The value 1 assigned to 'i' is never used">i</warning> = 1;
<warning descr="The value '1' assigned to 'i' is never used">i</warning> = 1;
try {
i = 2;
} finally {
@@ -4,9 +4,9 @@ class NestedTryFinallyInEndlessLoop {
while (true) {
try {
try {
<warning descr="The value 1 assigned to 'n' is never used">n</warning> = 1;
<warning descr="The value '1' assigned to 'n' is never used">n</warning> = 1;
} finally {
<warning descr="The value 2 assigned to 'n' is never used">n</warning> = 2;
<warning descr="The value '2' assigned to 'n' is never used">n</warning> = 2;
}
} catch (Throwable t) {
System.out.println(t);
@@ -19,12 +19,12 @@ class NestedTryFinallyInEndlessLoop {
while (true) {
try {
try {
<warning descr="The value 1 assigned to 'n' is never used">n</warning> = 1;
<warning descr="The value '1' assigned to 'n' is never used">n</warning> = 1;
} finally {
try {
<warning descr="The value 2 assigned to 'n' is never used">n</warning> = 2;
<warning descr="The value '2' assigned to 'n' is never used">n</warning> = 2;
} finally {
<warning descr="The value 3 assigned to 'n' is never used">n</warning> = 3;
<warning descr="The value '3' assigned to 'n' is never used">n</warning> = 3;
}
}
} catch (Throwable t) {
@@ -38,15 +38,15 @@ class NestedTryFinallyInEndlessLoop {
while (true) {
try {
try {
<warning descr="The value 1 assigned to 'n' is never used">n</warning> = 1;
<warning descr="The value '1' assigned to 'n' is never used">n</warning> = 1;
} finally {
try {
<warning descr="The value 2 assigned to 'n' is never used">n</warning> = 2;
<warning descr="The value '2' assigned to 'n' is never used">n</warning> = 2;
} finally {
try {
<warning descr="The value 3 assigned to 'n' is never used">n</warning> = 3;
<warning descr="The value '3' assigned to 'n' is never used">n</warning> = 3;
} finally {
<warning descr="The value 4 assigned to 'n' is never used">n</warning> = 4;
<warning descr="The value '4' assigned to 'n' is never used">n</warning> = 4;
}
}
}
@@ -61,18 +61,18 @@ class NestedTryFinallyInEndlessLoop {
while (true) {
try {
try {
<warning descr="The value 1 assigned to 'n' is never used">n</warning> = 1;
<warning descr="The value '1' assigned to 'n' is never used">n</warning> = 1;
} finally {
try {
<warning descr="The value 2 assigned to 'n' is never used">n</warning> = 2;
<warning descr="The value '2' assigned to 'n' is never used">n</warning> = 2;
} finally {
try {
<warning descr="The value 3 assigned to 'n' is never used">n</warning> = 3;
<warning descr="The value '3' assigned to 'n' is never used">n</warning> = 3;
} finally {
try {
<warning descr="The value 4 assigned to 'n' is never used">n</warning> = 4;
<warning descr="The value '4' assigned to 'n' is never used">n</warning> = 4;
} finally {
<warning descr="The value 5 assigned to 'n' is never used">n</warning> = 5;
<warning descr="The value '5' assigned to 'n' is never used">n</warning> = 5;
}
}
}
@@ -88,21 +88,21 @@ class NestedTryFinallyInEndlessLoop {
while (true) {
try {
try {
<warning descr="The value 1 assigned to 'n' is never used">n</warning> = 1;
<warning descr="The value '1' assigned to 'n' is never used">n</warning> = 1;
} finally {
try {
<warning descr="The value 2 assigned to 'n' is never used">n</warning> = 2;
<warning descr="The value '2' assigned to 'n' is never used">n</warning> = 2;
} finally {
try {
<warning descr="The value 3 assigned to 'n' is never used">n</warning> = 3;
<warning descr="The value '3' assigned to 'n' is never used">n</warning> = 3;
} finally {
try {
<warning descr="The value 4 assigned to 'n' is never used">n</warning> = 4;
<warning descr="The value '4' assigned to 'n' is never used">n</warning> = 4;
} finally {
try {
<warning descr="The value 5 assigned to 'n' is never used">n</warning> = 5;
<warning descr="The value '5' assigned to 'n' is never used">n</warning> = 5;
} finally {
<warning descr="The value 6 assigned to 'n' is never used">n</warning> = 6;
<warning descr="The value '6' assigned to 'n' is never used">n</warning> = 6;
}
}
}
@@ -2,7 +2,7 @@ class Foo {
private void f() {
int x = 10;
int t = x;
<warning descr="The value 10 assigned to 'x' is never used">x</warning> += 10;
<warning descr="The value '10' assigned to 'x' is never used">x</warning> += 10;
System.out.println(t);
}
}
@@ -1,7 +1,7 @@
class NotUsedTest {
public static void main(String[] args) {
boolean unused = true;
<warning descr="The value true assigned to 'unused' is never used">unused</warning> = true;
<warning descr="The value true assigned to 'unused' is never used">unused</warning> = true;
<warning descr="The value 'true' assigned to 'unused' is never used">unused</warning> = true;
<warning descr="The value 'true' assigned to 'unused' is never used">unused</warning> = true;
}
}
@@ -8,7 +8,7 @@ class X {
System.out.println(z);
z = (z = x);
System.out.println(z);
z = <warning descr="The value x assigned to 'y' is never used">y</warning> = x;
z = <warning descr="The value 'x' assigned to 'y' is never used">y</warning> = x;
System.out.println(z);
}
}
@@ -1,7 +1,7 @@
class C {
int f() {
int i = <warning descr="Variable 'i' initializer '0' is redundant">0</warning>;
<warning descr="The value 1 assigned to 'i' is never used">i</warning> = 1;
<warning descr="The value '1' assigned to 'i' is never used">i</warning> = 1;
i = 2;
return i;
}
@@ -2,7 +2,7 @@ class C {
int f(boolean b) {
int i;
try {
<warning descr="The value 0 assigned to 'i' is never used">i</warning> = 0;
<warning descr="The value '0' assigned to 'i' is never used">i</warning> = 0;
} finally {
if (b) throw new RuntimeException();
i = 1;
@@ -2,7 +2,7 @@ class C {
int f(boolean b) {
int i = <warning descr="Variable 'i' initializer '0' is redundant">0</warning>;
try {
<warning descr="The value 1 assigned to 'i' is never used">i</warning> = 1;
<warning descr="The value '1' assigned to 'i' is never used">i</warning> = 1;
if (b) throw new RuntimeException();
}
finally {
@@ -732,10 +732,10 @@ inspection.undeclared.service.usage.name=Usage of service not declared in 'modul
inspection.unused.assignment.option=Report ++i when may be replaced with (i + 1)
inspection.unused.assignment.option1=Report i++ when changed value is not used afterwards
inspection.unused.assignment.option2=Report redundant initializers
inspection.unused.assignment.problem.descriptor1=Variable {0} is never used
inspection.unused.assignment.problem.descriptor2=Variable {0} initializer {1} is redundant
inspection.unused.assignment.problem.descriptor3=The value {0} assigned to {1} is never used
inspection.unused.assignment.problem.descriptor4=The value changed at {0} is never used
inspection.unused.assignment.problem.descriptor1=Variable <code>#ref</code> #loc is never used
inspection.unused.assignment.problem.descriptor2=Variable <code>{0}</code> initializer <code>#ref</code> #loc is redundant
inspection.unused.assignment.problem.descriptor3=The value <code>{0}</code> assigned to <code>#ref</code> #loc is never used
inspection.unused.assignment.problem.descriptor4=The value changed at <code>#ref</code> #loc is never used
inspection.unused.assignment.remove.assignment.quickfix=Remove redundant assignment
inspection.unused.assignment.remove.quickfix=Remove redundant initializer
inspection.unused.parameter.composer=Parameter <code>#ref</code> is not used in any implementation