Several APIs have been deprecated in Java SE 9. This will cause `javac` to emit a variety of warnings during compilation. A *deprecation* warning will be emitted at the use site of an API deprecated with `forRemoval=false`. A *removal* warning will be emitted at the use site of an API deprecated with `forRemoval=true`.
A deprecation or removal warning is a recommendation that code be migrated away from the deprecated API. A removal warning is particularly strenuous, as it is an indication that the deprecated API will generally be removed from the next major release of the platform. However, it is not always practical to migrate code immediately. Therefore, two mechanisms have been provided for controlling the warnings that are emitted by `javac`: command-line options and annotations in source code.
The `javac` command-line options `-Xlint:deprecation` and `-Xlint:removal` will enable the respective warning types, and `-Xlint:-deprecation` and `-Xlint:-removal` will disable the respective warning types. Note that removal warnings are enabled by default.
The other mechanism is to add the `@SuppressWarnings("deprecation")` or `@SuppressWarnings("removal")` annotation to the source code. This annotation can be added at the declaration of a module, class, method, field, or local variable to suppress the respective warning types emitted within that declaration.
For further information about deprecation, see
and the documentation for the `java.lang.Deprecated` annotation type.