Skip to content

Commit 077484f

Browse files
Document limitation of String.format
The null case is a bit special.
1 parent 4392850 commit 077484f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main/java/java/lang/String.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3986,6 +3986,11 @@ static String cproverFormatArgument(Object obj) {
39863986
* <li>
39873987
* having 5 arguments or more makes the solver slow
39883988
* </li>
3989+
* <li>
3990+
* the string "null" is interpreted the same way {@code null} would be by
3991+
* the JDK String.format function, which is correct for the %s format
3992+
* specifier but not %b for instance.
3993+
* </li>
39893994
* </ul>
39903995
* @diffblue.untested
39913996
*/
@@ -4046,7 +4051,8 @@ public static String format(String format, Object... args) {
40464051
* @see java.util.Formatter
40474052
* @since 1.5
40484053
*
4049-
* @diffblue.limitedSupport The locale argument is ignored
4054+
* @diffblue.limitedSupport The locale argument is ignored and it has the
4055+
* same limitations as {@link #format(String, Object...)}.
40504056
*/
40514057
public static String format(Locale l, String format, Object... args) {
40524058
// return new Formatter(l).format(format, args).toString();

0 commit comments

Comments
 (0)