On Feb 18, 2009, at 12:05 PM, Perry Trolard wrote:

On the most recent svn (r1293), read-line throws a ClassCastException
when called:

user=> (read-line)
java.lang.ClassCastException: clojure.lang.LineNumberingPushbackReader
cannot be cast to java.io.BufferedReader (NO_SOURCE_FILE:0)

Removing the type hint solves the issue:

user=> (source read-line)
(defn read-line
 "Reads the next line from stream that is the current value of
*in* ."
 [] (. #^java.io.BufferedReader *in* (readLine)))
nil
user=> (.readLine *in*)
this is a line
"this is a line"

This is from issue 47, svn 1229. It's unfortunate that a class can't be both a BufferedReader and a PushbackReader simultaneously. Those classes were implemented using class inheritance rather than via interfaces. In this case, the default *in* is not a BufferedReader, but does provide readLine. It looks to me like removing the hint is the correct fix.

--Steve

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to