One point to re-emphasize is that deprecation doesn't imply imminent removal unless forRemoval=true. There seems to be some different reactions to new deprecations. One is apparent urgency at fixing up warnings, as if the deprecated APIs are going to be removed shortly. Another is resistance to deprecation because of the amount of work generated. Cleaning up warnings is a certain amount of work, but it might be that this is magnified by the assumption that the APIs will be removed (or be made "unstable") by the deprecation, which isn't true in most cases.
There are some pitfalls in removing these warnings by editing the source code. There should be a recommendation about a set of steps to take. For example, for the box constructor deprecations:
1) Disable deprecation warnings using -Xlint:-deprecation. Deprecation warnings are rarely the most important thing to deal with in migrating to JDK 9. This is only a temporary workaround, of course, but dealing with warnings needn't be in the critical path of migration.
2) Suppress warnings with @SuppressWarnings("deprecation"). This is useful at particular call sites that use the box constructors. This does add clutter to the code, but it's called for in certain uncommon cases where the code really does want to use a box constructor instead of an alternative. These cases are typically where the identity of a boxed value is significant, for example, if they are compared using == or !=, or if they are stored in an IdentityHashMap.
We are also considering other mechanisms for finer-grained warnings control.
3) Replace the constructor call with a call to valueOf(). For example, instead of new Integer(x), call Integer.valueOf(x). This is the safest transformation, since it avoids pitfalls with autoboxing and overload resolution. It doesn't preserve identity semantics, though, as noted above.
4) Converting to autoboxing is often safe but there are a number of "gotchas." For example, if 'list' is a List<Integer>, and 'x' is an int, then
list.remove(new Integer(x))
must not be changed to
list.remove(x)
because this changes overload resolution so that List.remove(int) is called instead of List.remove(Object).
==========
In addition to enhancements to deprecation itself, the release notes should also cover features, APIs, and packages that have been deprecated. Issues relating to deprecation of those should be linked to this subtask.
- relates to
-
JDK-8145469 deprecate legacy collections: Vector, Hashtable, etc.
- Open
-
JDK-8154799 deprecate Timer and TimerTask
- Open
-
JDK-8145468 update java.lang APIs with new deprecations
- Resolved
-
JDK-8153330 deprecate Runtime.traceInstructions() and traceMethodCalls()
- Resolved
-
JDK-8154801 deprecate Observer and Observable
- Resolved
-
JDK-8156205 Release Note: Changes in logging interface in MXBean
- Closed
-
JDK-8073972 Deprecate Multi-Version Java Launcher (mJRE) for JDK8
- Resolved
-
JDK-8078399 Obsolete -Xoss, -Xsqnopause, -Xoptimize and -Xboundthreads options in JDK 9
- Resolved
-
JDK-8133453 Deprecate AWTKeyStroke.registerSubclass(Class) method
- Resolved
-
JDK-8156960 Deprecate JSObject.getWindow(Applet) method
- Resolved
-
JDK-8156963 Deprecate HostServices.getWebContext method
- Resolved
-
JDK-8054494 Remove sun.misc.Unsafe.monitorEnter, monitorExit and tryMonitorEnter
- Resolved
-
JDK-8035473 [javadoc] Revamp the existing Doclet APIs
- Closed
-
JDK-8137067 Deprecate the old doclet
- Closed
-
JDK-8157606 deprecate com.sun.javadoc API
- Closed
-
JDK-8157608 deprecate old entry points for javadoc tool
- Closed
-
JDK-8134330 Deprecate VP6/FXM/FLV support in JavaFX Media
- Resolved
-
JDK-8069967 Deprecate the Extension Mechanism
- Resolved
-
JDK-8073430 Deprecate security APIs that have been superseded
- Resolved
-
JDK-8140281 (opt) add no-arg orElseThrow() as preferred alternative to get()
- Resolved
-
JDK-8147400 Deprecate policytool
- Resolved
-
JDK-6850612 Deprecate Class.newInstance since it violates the checked exception language contract
- Resolved
-
JDK-8076535 Deprecate the com.sun.jarsigner package
- Resolved
-
JDK-8145235 Deprecate product flags that have been converted to Unified Logging
- Resolved
-
JDK-4285505 deprecate java.lang.Compiler
- Closed
-
JDK-8142518 JEP 291: Deprecate the Concurrent Mark Sweep (CMS) Garbage Collector
- Closed
-
JDK-8149502 JEP 289: Deprecate the Applet API
- Closed
-
JDK-8132546 Deprecate IgnoreUnrecognizedVMOptions
- Closed
-
JDK-8152360 deprecate javah
- Closed