Clojure

[core.specs] String array hinting in :gen-class fails spec - No other method available

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: Release 1.9
  • Fix Version/s: Release 1.10
  • Component/s: None
  • Labels:
  • Patch:
    Code
  • Approval:
    Ok

Description

When defining methods via :gen-class in the ns declaration, array return types do not appear to have a method of specification as they used to. Formerly, a String like "[Ljava.lang.Object;" could be used to define a typed array return.

A complete example can be made by creating the following ns then adding `:aot [sandbox.ltoa]` to the project.clj file:

(ns sandbox.ltoa
  (:gen-class
    :name sandbox.LTOA
    :methods [^:static [longToArrayOfLongs [Long] "[Ljava.lang.Long;"]]))

(defn -longToArrayOfLongs [id]
  (into-array [id]))

For reference, examples that formerly worked can be found at:

Per @alexmiller, the problem can be found at https://github.com/clojure/core.specs.alpha/blob/master/src/main/clojure/clojure/core/specs/alpha.clj#L184.

Patch: 0001-CLJ-2314-allow-string-array-hinting-in-genclass-retu.patch

Screened by: Alex Miller

Activity

Hide
Alex Miller added a comment -

Applied

Show
Alex Miller added a comment - Applied

People

Vote (1)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: