GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Error Prone
  • Bug Patterns
  • Docs
  • GitHub

This view

  • Original page
  • New address

GeezerVison is showing errorprone.info — ExpensiveLenientFormatString

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.

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.