error-prone icon indicating copy to clipboard operation
error-prone copied to clipboard

FormatMethod: about the position of the argument: [FormatStringAnnotation] extra format arguments: used 0, provided 1

Open coolderli opened this issue 1 year ago • 0 comments

Hi, I'm using @FormatMethod to format my code. Should the argument be behind the format string?

If I write as below, I will get an error.

@FormatMethod
  public GravitinoRuntimeException(@FormatString String message, Object... args) {
    super(String.format(message, args));
  }

@FormatMethod
public GravitinoRuntimeException(@FormatString String message, Throwable cause, Object... args) {
    super(String.format(message, args), cause);
  }

new GravitinoRuntimeException("Error creating datasource", exception)

The error like:

[FormatStringAnnotation] extra format arguments: used 0, provided 1

Thanks.

coolderli avatar Feb 07 '24 08:02 coolderli