JDK-8176334 : Release Note: Deprecation Warnings Introduced
  • Type: Sub-task
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 9
  • Priority: P3
  • Status: Closed
  • Resolution: Delivered
  • Submitted: 2017-03-08
  • Updated: 2017-09-22
  • Resolved: 2017-03-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9Resolved
Description
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
[JEP 277](http://openjdk.java.net/jeps/277)
and the documentation for the `java.lang.Deprecated` annotation type.