Skip to content

Commit ec2ac9d

Browse files
authored
Use String.format instead of static import (#61)
This makes the associated webpage clearer
1 parent 7de7ae9 commit ec2ac9d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/java/detectors/string_format_arguments/StringFormatArguments.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@
77

88
import lombok.extern.slf4j.Slf4j;
99
import java.io.File;
10-
import static java.lang.String.format;
1110

1211
@Slf4j
1312
public class StringFormatArguments {
1413
// {fact rule=string-format-arguments@v1.0 defects=1}
1514
void formatStringNoncompliant(final File file) {
1615
final long length = file.length();
1716
// Noncompliant: avoids using the correct format strings for their argument types.
18-
final String s = format("File length is %s", length);
17+
final String s = String.format("File length is %s", length);
1918
log.info(s);
2019
}
2120
// {/fact}
@@ -24,7 +23,7 @@ void formatStringNoncompliant(final File file) {
2423
void formatStringCompliant(final File file) {
2524
final long length = file.length();
2625
// Compliant: uses the correct format strings for their argument types.
27-
final String s = format("File length is %d", length);
26+
final String s = String.format("File length is %d", length);
2827
log.info(s);
2928
}
3029
// {/fact}

0 commit comments

Comments
 (0)