IDEA-312818 [java-inspections] "Replace concatenation" naming is too long

GitOrigin-RevId: 732e1b24a1ce6c3f3791ad18483865eada50f529
This commit is contained in:
Mikhail Pyltsin
2023-03-20 10:54:18 +01:00
committed by intellij-monorepo-bot
parent 09a1e4c5e8
commit 4390e0ec86
12 changed files with 14 additions and 13 deletions

View File

@@ -1,4 +1,4 @@
// "Replace '0x7fffffffffffffffL == 0x7ffffffffffffffeL' with constant value 'false'" "true-preview"
// "Compute constant value of '0x7fffffffffffffffL == 0x7ffffffffffffffeL'" "true-preview"
class Test {
boolean result = false;
}

View File

@@ -1,4 +1,4 @@
// "Compute constant value of '"The quick brown fox jumps " + 100000 + " times" + " over the lazy dog"'" "true-preview"
// "Replace with constant value" "true-preview"
class Test {
void test() {
// Do not display the result in action name

View File

@@ -1,4 +1,4 @@
// "Replace '"a" + "b"' with constant value '"ab"'" "true-preview"
// "Compute constant value of '"a" + "b"'" "true-preview"
class Test {
String x = ("ab");
}

View File

@@ -1,4 +1,4 @@
// "Replace '2 * 2' with constant value '4'" "true-preview"
// "Compute constant value of '2 * 2'" "true-preview"
class Test {
int x = 4;
}

View File

@@ -1,4 +1,4 @@
// "Replace '~2' with constant value '-3'" "true-preview"
// "Compute constant value of '~2'" "true-preview"
class Test {
int x = -3;
}

View File

@@ -1,4 +1,4 @@
// "Replace '0x7fffffffffffffffL == 0x7ffffffffffffffeL' with constant value 'false'" "true-preview"
// "Compute constant value of '0x7fffffffffffffffL == 0x7ffffffffffffffeL'" "true-preview"
class Test {
boolean result = 0x7fffffffffffffffL<caret> == 0x7ffffffffffffffeL;
}

View File

@@ -1,4 +1,4 @@
// "Compute constant value of '"The quick brown fox jumps " + 100000 + " times" + " over the lazy dog"'" "true-preview"
// "Replace with constant value" "true-preview"
class Test {
void test() {
// Do not display the result in action name

View File

@@ -1,4 +1,4 @@
// "Replace '"a" + "b"' with constant value '"ab"'" "true-preview"
// "Compute constant value of '"a" + "b"'" "true-preview"
class Test {
String x = ("a" + <caret>"b");
}

View File

@@ -1,4 +1,4 @@
// "Replace '2 * 2' with constant value '4'" "true-preview"
// "Compute constant value of '2 * 2'" "true-preview"
class Test {
int x = 2*<caret>2;
}

View File

@@ -1,4 +1,4 @@
// "Replace '~2' with constant value '-3'" "true-preview"
// "Compute constant value of '~2'" "true-preview"
class Test {
int x = ~<caret>2;
}

View File

@@ -2262,6 +2262,7 @@ fix.add.argument.name=Add ''{0}'' argument
inspection.constant.expression.display.name=Constant expression can be evaluated
inspection.constant.expression.message=Constant expression can be evaluated to ''{0}''
inspection.constant.expression.fix.name=Compute constant value of ''{0}''
inspection.constant.expression.fix.name.short=Replace with constant value
inspection.constant.expression.fix.name.with.value=Replace ''{0}'' with constant value ''{1}''
inspection.constant.expression.fix.family.name=Compute constant value

View File

@@ -20,7 +20,7 @@ import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
public class ConstantExpressionInspection extends AbstractBaseJavaLocalInspectionTool {
private static final int MAX_RESULT_LENGTH_TO_DISPLAY = 50;
private static final int MAX_RESULT_LENGTH_TO_DISPLAY = 40;
private static final int MAX_EXPRESSION_LENGTH = 200;
@NotNull
@@ -77,10 +77,10 @@ public class ConstantExpressionInspection extends AbstractBaseJavaLocalInspectio
@NotNull
@Override
public String getName() {
if (myValueText.length() > MAX_RESULT_LENGTH_TO_DISPLAY) {
if (myValueText.length() < MAX_RESULT_LENGTH_TO_DISPLAY) {
return InspectionGadgetsBundle.message("inspection.constant.expression.fix.name", myText);
}
return InspectionGadgetsBundle.message("inspection.constant.expression.fix.name.with.value", myText, myValueText);
return InspectionGadgetsBundle.message("inspection.constant.expression.fix.name.short");
}
@Nls