Address JDK API deprecations

Description

The JDK now has a clearer policy regarding API deprecations. Currently, there are 6 deprecated call sites in Clojure as of Java 11:

The first two occur in clj files, and have clear replacement calls. The patch makes these replacements.

The next three (the Long(long) constructors) are emitted by the compiler via asm's GeneratorAdapter while boxing invokeStatic and invokePrim. The Long constructors were deprecated in JDK9 [1], with the note that Hotspot intrinsifies the preferred call (Long/valueOf). GeneratorAdapter also has a valueOf() method so in the case of long/double returns, this is used instead (and otherwise it falls back to prior behavior).

Addressing all of the above remains compatible with JDK8. The last issue is reported as of JDK 9. It recommends using getDefinedPackage instead, but that method does not exist until JDK 9 and we are using a JDK 8 baseline, so no change was made. (The method still exists through Java 11 and has not been removed.)

Patch: clj-2375-2.patch

Environment

None

Attachments

2

Activity

Alex Miller 
October 3, 2018 at 4:30 PM

Tested open-url-in-swing still works (for browse-ui change):

Tested cl-format still works (this invokes the changed code path):

Tested these produce the same values are the same before/after:

Completed

Details

Assignee

Reporter

Labels

Approval

Patch

Priority

Affects versions

Fix versions

Created July 11, 2018 at 10:31 PM
Updated October 5, 2018 at 12:19 AM
Resolved October 5, 2018 at 12:19 AM