Clojure

"Conflicting data-reader mapping" triggered when the same data_readers.clj is on the classpath twice

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: Release 1.5
  • Component/s: None
  • Labels:
    None
  • Approval:
    Ok

Description

If you have two data_readers.clj files on the classpath that agree with one another about the mapping of a given literal, Clojure still claims there is a conflict.

Activity

Hide
Justin Kramer added a comment - - edited

This comes up when using checkout dependencies in Leiningen. If the checked-out project contains data_readers.clj, Clojure will throw an exception.

To reproduce:

user=> (spit "/tmp/data_readers.clj" "{foo/bar foo.core/bar}")
nil
user=> (with-redefs [clojure.core/data-reader-urls (constantly [(java.net.URL. "file:/tmp/data_readers.clj")])] (#'clojure.core/load-data-readers))
{foo/bar #'foo.core/bar}
user=> (with-redefs [clojure.core/data-reader-urls (constantly [(java.net.URL. "file:/tmp/data_readers.clj")])] (#'clojure.core/load-data-readers))
ExceptionInfo Conflicting data-reader mapping clojure.core/ex-info (core.clj:4227)

Show
Justin Kramer added a comment - - edited This comes up when using checkout dependencies in Leiningen. If the checked-out project contains data_readers.clj, Clojure will throw an exception. To reproduce: user=> (spit "/tmp/data_readers.clj" "{foo/bar foo.core/bar}") nil user=> (with-redefs [clojure.core/data-reader-urls (constantly [(java.net.URL. "file:/tmp/data_readers.clj")])] (#'clojure.core/load-data-readers)) {foo/bar #'foo.core/bar} user=> (with-redefs [clojure.core/data-reader-urls (constantly [(java.net.URL. "file:/tmp/data_readers.clj")])] (#'clojure.core/load-data-readers)) ExceptionInfo Conflicting data-reader mapping clojure.core/ex-info (core.clj:4227)
Hide
Justin Kramer added a comment -

Attached clj_1034_data_readers_fix.diff with simple fix: checks that new mappings actually point to different vars before claiming a conflict.

Show
Justin Kramer added a comment - Attached clj_1034_data_readers_fix.diff with simple fix: checks that new mappings actually point to different vars before claiming a conflict.

People

Vote (10)
Watch (5)

Dates

  • Created:
    Updated:
    Resolved: