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

Activity

Show:
Alex Miller
October 3, 2018, 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

Assignee

Unassigned

Reporter

Ghadi Shayban

Labels

Approval

Ok

Patch

Code

Fix versions

Affects versions

Priority

Minor
Configure