Skip to content

Commit 15073f6

Browse files
committed
Drop type-hints from assoc-conversion to work around AOT issue
Since this function is usually not called at runtime, the reflection performance penalty should be tolerable. Fixes clj-commons#68
1 parent 0dff201 commit 15073f6

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

src/byte_streams/graph.clj

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,15 @@
118118
IConversionGraph
119119
(assoc-conversion [_ src dst f cost]
120120
(let [m' (assoc-in m [src dst] (Conversion. f cost))
121+
;; NOTE: These method calls are
122+
;; intentionally done without type-hints to
123+
;; work around
124+
;; https://github.com/clj-commons/byte-streams/issues/68
121125
m' (if (and
122-
(nil? (.wrapper ^Type src))
123-
(nil? (.wrapper ^Type dst)))
124-
(let [src (.type ^Type src)
125-
dst (.type ^Type dst)]
126+
(nil? (.wrapper src))
127+
(nil? (.wrapper dst)))
128+
(let [src (.type src)
129+
dst (.type dst)]
126130
(-> m'
127131
(assoc-in [(Type. 'seq src) (Type. 'seq dst)]
128132
(Conversion. (fn [x options] (map #(f % options) x)) cost))

src/clj_commons/byte_streams/graph.clj

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,15 @@
113113
IConversionGraph
114114
(assoc-conversion [_ src dst f cost]
115115
(let [m' (assoc-in m [src dst] (Conversion. f cost))
116+
;; NOTE: These method calls are
117+
;; intentionally done without type-hints to
118+
;; work around
119+
;; https://github.com/clj-commons/byte-streams/issues/68
116120
m' (if (and
117-
(nil? (.wrapper ^Type src))
118-
(nil? (.wrapper ^Type dst)))
119-
(let [src (.type ^Type src)
120-
dst (.type ^Type dst)]
121+
(nil? (.wrapper src))
122+
(nil? (.wrapper dst)))
123+
(let [src (.type src)
124+
dst (.type dst)]
121125
(-> m'
122126
(assoc-in [(Type. 'seq src) (Type. 'seq dst)]
123127
(Conversion. (fn [x options] (map #(f % options) x)) cost))

0 commit comments

Comments
 (0)