Java: Support String.formatted in the format string queries.

This commit is contained in:
Anders Schack-Mulligen
2020-08-17 15:01:48 +02:00
parent 28a7656813
commit a5701db3fa
5 changed files with 18 additions and 2 deletions

View File

@@ -85,4 +85,9 @@ public class A {
String.format("%s%s", a2); // ok
String.format("%s", a2); // unused
}
void formatted() {
"%s%s".formatted(""); // missing
"%s".formatted("", ""); // unused
}
}

View File

@@ -17,3 +17,4 @@
| A.java:74:5:74:47 | format(...) | This format call refers to 2 argument(s) but only supplies 1 argument(s). |
| A.java:79:5:79:31 | format(...) | This format call refers to 3 argument(s) but only supplies 2 argument(s). |
| A.java:84:5:84:31 | format(...) | This format call refers to 3 argument(s) but only supplies 2 argument(s). |
| A.java:90:5:90:24 | formatted(...) | This format call refers to 2 argument(s) but only supplies 1 argument(s). |

View File

@@ -9,3 +9,4 @@
| A.java:76:5:76:57 | format(...) | This format call refers to 2 argument(s) but supplies 3 argument(s). |
| A.java:81:5:81:27 | format(...) | This format call refers to 1 argument(s) but supplies 2 argument(s). |
| A.java:86:5:86:27 | format(...) | This format call refers to 1 argument(s) but supplies 2 argument(s). |
| A.java:91:5:91:26 | formatted(...) | This format call refers to 1 argument(s) but supplies 2 argument(s). |

View File

@@ -0,0 +1 @@
//semmle-extractor-options: --javac-args --enable-preview -source 14 -target 14