Thanks for your help, Dalibor and Rory. At this point, we have updated Derby so that it compiles without any deprecation warnings on early access build 118 of JDK 9. I wanted to share my experience with you. For more detail, please see https://issues.apache.org/jira/browse/DERBY-6856

o Deprecating Class.newInstance() - Eliminating these warnings was an enormous task on a large, old code base like Derby, whose oldest code dates from Java 1.2. Invocations have to be replaced with more verbose code and extra exceptions have to be caught and propagated up the call stack. For reasons which I don't understand, I had better luck using Class.getConstructor().newInstance() than Class.getDeclaredConstructor().newInstance(). But the former replacement code requires you to make constructors public. For some code bases, that may introduce security problems which are worse than the security problem being addressed by this deprecation. I hope that IDEs and the release notes for JDK 9 will provide some guidance for how to handle these issues.

o Deprecating java.util.Observable and java.util.Observer - Two ameliorations are recommended at http://mail.openjdk.java.net/pipermail/core-libs-dev/2016-April/040436.html. The first suggestion (use the awt event model) runs very much counter to the whole intent of Jigsaw. That is because pulling in awt can bloat up an application with large, otherwise unneeded libraries. Using awt was out of the question for Derby, given that the community had already invested a great deal of effort in paring back Derby's dependencies in order to let the code run on JDK 8 compact profile 2. That left us with the other option: write your own replacement classes. If a lot of people end up having to write the same replacement code, then that argues for leaving this small but useful functionality in the JDK. I think that the people who advocated for this deprecation did not have good visibility into how widely these classes are being used in the wild. I recommend that this deprecation be re-evaluated.

Thanks,
-Rick

On 5/19/16 5:02 AM, dalibor topic wrote:


On 19.05.2016 04:24, Rick Hillegas wrote:
Hi Rory,

I have tried building Derby with b118. This produced a new boatload of
deprecation warnings which do not seem to be covered by the summary
description of the changes at
http://download.java.net/java/jdk9/changes/jdk-9+118.html.

Thanks Rick, it seems that the list of changes is incomplete. I'll pass that on to the team publishing that list.

The
deprecations are not described in the jdk 9 javadoc at
http://download.java.net/java/jdk9/docs/api/index.html.

Indeed, the docs there are out of date (b116) - I'll pass that on as well, thanks!

Can you
recommend any best practices for ameliorating these deprecation
warnings? A summary of these deprecation warnings follows:

o Deprecation of java.util.Observer and java.util.Observable

See http://mail.openjdk.java.net/pipermail/core-libs-dev/2016-April/040436.html

o Deprecation of Class.newInstance()

See http://mail.openjdk.java.net/pipermail/core-libs-dev/2016-April/040283.html


o Deprecation of various constants and methods in BigDecimal, including
ROUND_DOWN, setScale(int,int), divide(BigDecimal,int,int),

See http://mail.openjdk.java.net/pipermail/core-libs-dev/2016-May/040707.html

cheers,
dalibor topic

Reply via email to