Skip to content

AnnotateFormatMethod suggests adding non-existent annotation @LenientFormatString #5554

@scranen

Description

@scranen

The AnnotateFormatMethod check was updated in #5025 to add support for @LenientFormatString, but that annotation does not seem to exist. I've attached a minimal example to reproduce

LenientFormatString.zip

Output:

$ mvn clean compile
...
[WARNING] /private/tmp/annotate-format-repro/src/main/java/com/example/Example.java:[7,21] [AnnotateFormatMethod] This method uses a pair of parameters as a format string and its arguments, but the enclosing method wasn't annotated. Doing so gives compile-time rather than run-time protection against malformed format strings.
    (see https://errorprone.info/bugpattern/AnnotateFormatMethod)
  Did you mean 'public static void helloWorld(int arg1, @LenientFormatString String template, Object... args) {'?
...
$ mvn clean compile -Ppatch > /dev/null
$ mvn clean compile
...
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /private/tmp/annotate-format-repro/src/main/java/com/example/Example.java:[5,40] error: cannot find symbol
  symbol:   class LenientFormatString
  location: package com.google.errorprone.annotations
[ERROR] /private/tmp/annotate-format-repro/src/main/java/com/example/Example.java:[9,43] error: cannot find symbol
  symbol:   class LenientFormatString
  location: class Example
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions