Skip to content

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

Closed

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

Activity

  1. added a commit that references this issue on Jul 22, 2024
  2. added a commit that references this issue on Jul 23, 2024
  3. added this to the 18.0.0 milestone on Jul 23, 2024
  4. lidavidm commented on Jul 23, 2024

    @lidavidm
    Member

    Issue resolved by pull request 43376
    #43376

  5. added a commit that references this issue on Oct 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions