IJ-CR-130369 [java-inspections] IDEA-197280 Non-constant string concatenation as argument" could also be triggered for String.format

- change description

GitOrigin-RevId: 0924d1165a47e2d40f3b245adfdc8252f2768f25
This commit is contained in:
Mikhail Pyltsin
2024-05-23 17:38:59 +02:00
committed by intellij-monorepo-bot
parent 50f4960173
commit 7e047434f3
2 changed files with 9 additions and 9 deletions

View File

@@ -1922,7 +1922,7 @@ arrays.as.list.with.zero.or.one.argument.display.name=Call to 'Arrays.asList()'
arrays.as.list.with.one.argument.problem.descriptor=Call to <code>#ref()</code> with only one argument #loc
arrays.as.list.with.zero.arguments.problem.descriptor=Call to <code>#ref()</code> to create an empty List #loc
string.concatenation.argument.to.log.call.display.name=Non-constant string concatenation as argument to logging call
string.concatenation.argument.to.log.call.problem.descriptor=Evaluated string as argument to <code>#ref()</code> logging call #loc
string.concatenation.argument.to.log.call.problem.descriptor=Non-constant string as argument to <code>#ref()</code> logging call #loc
string.concatenation.argument.to.log.call.quickfix=Replace concatenation with parameterized log message
string.concatenation.argument.to.log.string.format.call.quickfix=Replace 'String.format()' with parameterized log message
string.concatenation.argument.to.log.message.format.call.quickfix=Replace 'Message.format()' with parameterized log message

View File

@@ -86,7 +86,7 @@ public class StringConcatenationArgumentToLogCallInspectionTest extends LightJav
Logger logger = LoggerFactory.getLogger(X.class);
final String CONST = "const";
String var = "var";
logger./*Evaluated string as argument to 'debug()' logging call*/debug/**/("string " + var + CONST);
logger./*Non-constant string as argument to 'debug()' logging call*/debug/**/("string " + var + CONST);
}
}"""
);
@@ -109,8 +109,8 @@ public class StringConcatenationArgumentToLogCallInspectionTest extends LightJav
class Logging {
private static final Logger LOG = LogManager.getLogger();
void m(int i) {
LOG./*Evaluated string as argument to 'info()' logging call*/info/**/("hello? " + i);
LOG./*Evaluated string as argument to 'fatal()' logging call*/fatal/**/("you got me " + i);
LOG./*Non-constant string as argument to 'info()' logging call*/info/**/("hello? " + i);
LOG./*Non-constant string as argument to 'fatal()' logging call*/fatal/**/("you got me " + i);
}
}""");
}
@@ -124,7 +124,7 @@ public class StringConcatenationArgumentToLogCallInspectionTest extends LightJav
private static final Logger logger = LogManager.getFormattedLogger();
public static void m(String a) {
logger./*Evaluated string as argument to 'info()' logging call*/info/**/("1" + "2" + a);
logger./*Non-constant string as argument to 'info()' logging call*/info/**/("1" + "2" + a);
}
}""");
}
@@ -135,8 +135,8 @@ public class StringConcatenationArgumentToLogCallInspectionTest extends LightJav
class Logging {
private static final Logger LOG = LogManager.getLogger();
void m(int i) {
LOG.atDebug()./*Evaluated string as argument to 'log()' logging call*/log/**/("hello? " + i);
LOG.atInfo()./*Evaluated string as argument to 'log()' logging call*/log/**/("you got me " + i);
LOG.atDebug()./*Non-constant string as argument to 'log()' logging call*/log/**/("hello? " + i);
LOG.atInfo()./*Non-constant string as argument to 'log()' logging call*/log/**/("you got me " + i);
}
}""");
}
@@ -148,7 +148,7 @@ public class StringConcatenationArgumentToLogCallInspectionTest extends LightJav
class X {
void foo() {
Logger log = LoggerFactory.getLogger(X.class);
log./*Evaluated string as argument to 'info()' logging call*/info/**/(String.format("%s %d", "1", 1));
log./*Non-constant string as argument to 'info()' logging call*/info/**/(String.format("%s %d", "1", 1));
}
}"""
);
@@ -161,7 +161,7 @@ public class StringConcatenationArgumentToLogCallInspectionTest extends LightJav
class X {
void foo() {
Logger log = LoggerFactory.getLogger(X.class);
log./*Evaluated string as argument to 'info()' logging call*/info/**/(MessageFormat.format("{1}, {0}", "1", 2));
log./*Non-constant string as argument to 'info()' logging call*/info/**/(MessageFormat.format("{1}, {0}", "1", 2));
}
}"""
);