Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java: suppress warning "X is marked unstable"

I am using the com.google.common.net.MediaType class from the Google Guava library and it is marked as @Beta. I'd like to suppress warnings that this is marked as unstable.

What's the @SuppressWarnings key do I need to use?

like image 856
Kousha Avatar asked Sep 21 '18 22:09

Kousha


People also ask

What is SuppressWarnings annotation in Java?

Annotation Type SuppressWarningsIndicates that the named compiler warnings should be suppressed in the annotated element (and in all program elements contained in the annotated element). Note that the set of warnings suppressed in a given element is a superset of the warnings suppressed in all containing elements.

What does @SuppressWarnings mean?

@SuppressWarnings instruct the compiler to ignore or suppress, specified compiler warning in annotated element and all program elements inside that element. For example, if a class is annotated to suppress a particular warning, then a warning generated in a method inside that class will also be separated.

What is suppress warning unused?

The @SuppressWarnings annotation disables certain compiler warnings. In this case, the warning about deprecated code ( "deprecation" ) and unused local variables or unused private methods ( "unused" ).


1 Answers

You can use @SuppressWarnings("UnstableApiUsage") to suppress those warnings.

like image 171
Mureinik Avatar answered Oct 27 '22 03:10

Mureinik