ExpensiveLenientFormatString
String.format is passed to a lenient formatting method, which can be unwrapped to improve efficiency.

Severity
WARNING

Alternate names: PreconditionsExpensiveString

The problem

Lenient format strings, such as those accepted by Preconditions, are often constructed lazily. The message is rarely needed, so it should either be cheap to construct or constructed only when needed. This check ensures that these messages are not constructed using expensive methods that are evaluated eagerly.

Prefer this:

checkNotNull(foo, "hello %s", name);

instead of this:

checkNotNull(foo, String.format("hello %s", name));

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("ExpensiveLenientFormatString") to the enclosing element.