How to suppress errorprone warnings without getting a warning from eclipse?

3k Views Asked by At

I wonder if it's possible to locally suppress errorprone warnings without getting an Eclipse warning instead. For example, with this line

private final byte[] magicBytes;

in an enum, I get the ImmutableEnumChecker warning as byte[] is mutable. This makes sense, but I ensured that it never leaks and never gets mutated, so I'd like to suppress the warning here. I don't want to suppress it globally, so I can't use the command line parameters and with

@SuppressWarnings("ImmutableEnumChecker")

I only trade the errorprone warning for the Eclipse warning Unsupported @SuppressWarnings("ImmutableEnumChecker").

Before, I used to use findbugs which has @SuppressFBWarnings for this very reason....

Is there something like "SuppressFBWarnings" in errorprone? Or any other solution?

1

There are 1 best solutions below

1
Lonzak On

There is an option in eclipse to supress the @SuppressWarnings("ImmutableEnumChecker") annotation. Go to Settings -> Java -> Compiler -> Errors/Warnings -> Annotations -> Unhandled Token in '@SuppressWarnings' and set it to ignore.

Additionally there are bug/feature reports for eclipse where you can vote/contribute:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=392045

https://bugs.eclipse.org/bugs/show_bug.cgi?id=122475