Skip to content

[Java] ErrorProne Enhancements with @FormatMethod and @FormatString #41951

@vibhatha

Description

@vibhatha

Describe the enhancement requested

ErrorProne warnings have been common to functions with a similar signature as follows.

private void hist(String noteFormat, Object... args) {
  if (historicalLog != null) {
    historicalLog.recordEvent(noteFormat, args);
  }
}

And they must be updated as follows.

@FormatMethod
private void hist(@FormatString String noteFormat, Object... args) {
  if (historicalLog != null) {
    historicalLog.recordEvent(noteFormat, args);
  }
}

At the moment, this would be suppressed based on the discussion here. But this must be resolved once we support JDK11+.

Component(s)

Java

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions