Clojure-Contrib

clojure.contrib.shell broken with clojure commit 37d8f7a

Details

  • Type: Defect Defect
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

clojure.core/byte was modified a couple weeks ago as follows:

(defn byte
"Coerce to byte"
{:tag Byte
:inline (fn [x] `(. clojure.lang.RT (byteCast ~x)))}

  • [^Number x] (. x (byteValue)))
    + [^Number x] (clojure.lang.RT/byteCast x))

byteValue and byteCast behave differently with values outside the
range of byte values:
user=> (. 255 (byteValue))
-1
user=> (clojure.lang.RT/byteCast 255)
java.lang.IllegalArgumentException: Value out of range for byte: 255
(NO_SOURCE_FILE:0)

The new version breaks clojure.contrib.shell/sh's :out :bytes mode (mapping byte over values returned by InputStream.read in shell.clj, line 125).
Perhaps have sh use #(.byteValue %) instead of byte? (untested)

Activity

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated: