cloroutine icon indicating copy to clipboard operation
cloroutine copied to clipboard

java interop failure

Open dustingetz opened this issue 1 year ago • 1 comments

Leo said: "it may be a cloroutine bug, move .readLine in a wrapper function"

#?(:clj (defn readerReadLine [r] (.readLine r)))

#?(:clj
   (defn file-stream [uri]
     (m/ap
      (with-open [r (clojure.java.io/reader uri)]
        (loop []
          (m/amb
           (m/? (m/via m/blk (.readLine r))) #_(readerReadLine r) ; ------------ here
           (recur)))))))

As written, crashes with below error. Wrapping .readLine in a clojure fn resolves the issue.

#error {
 :cause "No matching field found: readLine for class java.io.BufferedReader"
 :via
 [{:type java.lang.IllegalArgumentException
   :message "No matching field found: readLine for class java.io.BufferedReader"
   :at [clojure.lang.Reflector invokeNoArgInstanceMember "Reflector.java" 434]}]

dustingetz avatar Dec 01 '23 18:12 dustingetz