Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop type-hints from assoc-conversion to work around AOT issue #69

Merged
merged 2 commits into from
Feb 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@
:default (complement :stress)}
:plugins [[jonase/eastwood "1.3.0"]
[lein-cljfmt "0.9.0"]]
:eastwood {:ignored-faults {:reflection {clj-commons.byte-streams.graph [{:line 121}
{:line 122}
{:line 123}
{:line 124}]
byte-streams.graph [{:line 126}
{:line 127}
{:line 128}
{:line 129}]}}}
:global-vars {*warn-on-reflection* true}
:java-source-paths ["src"]
:javac-options ["-target" "1.8" "-source" "1.8"]
Expand Down
12 changes: 8 additions & 4 deletions src/byte_streams/graph.clj
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,15 @@
IConversionGraph
(assoc-conversion [_ src dst f cost]
(let [m' (assoc-in m [src dst] (Conversion. f cost))
;; NOTE: These method calls are
;; intentionally done without type-hints to
;; work around
;; https://github.com/clj-commons/byte-streams/issues/68
m' (if (and
(nil? (.wrapper ^Type src))
(nil? (.wrapper ^Type dst)))
(let [src (.type ^Type src)
dst (.type ^Type dst)]
(nil? (.wrapper src))
(nil? (.wrapper dst)))
(let [src (.type src)
dst (.type dst)]
(-> m'
(assoc-in [(Type. 'seq src) (Type. 'seq dst)]
(Conversion. (fn [x options] (map #(f % options) x)) cost))
Expand Down
12 changes: 8 additions & 4 deletions src/clj_commons/byte_streams/graph.clj
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,15 @@
IConversionGraph
(assoc-conversion [_ src dst f cost]
(let [m' (assoc-in m [src dst] (Conversion. f cost))
;; NOTE: These method calls are
;; intentionally done without type-hints to
;; work around
;; https://github.com/clj-commons/byte-streams/issues/68
m' (if (and
(nil? (.wrapper ^Type src))
(nil? (.wrapper ^Type dst)))
(let [src (.type ^Type src)
dst (.type ^Type dst)]
(nil? (.wrapper src))
(nil? (.wrapper dst)))
(let [src (.type src)
dst (.type dst)]
(-> m'
(assoc-in [(Type. 'seq src) (Type. 'seq dst)]
(Conversion. (fn [x options] (map #(f % options) x)) cost))
Expand Down