Skip to content

Commit b22f641

Browse files
authored
Make library more GraalVM native-image friendly (#52)
1 parent 41fec38 commit b22f641

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Unreleased
44

5-
...
5+
* Make library more GraalVM `native-image` friendly
66

77
## 0.7.184
88

src/nextjournal/markdown/impl.clj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,9 @@
223223

224224
(def ^:private visitChildren-meth
225225
;; cached reflection only happens once
226-
(delay (let [meth (.getDeclaredMethod AbstractVisitor "visitChildren" (into-array [Node]))]
227-
(.setAccessible meth true)
228-
meth)))
226+
(let [meth (.getDeclaredMethod AbstractVisitor "visitChildren" (into-array [Node]))]
227+
(.setAccessible meth true)
228+
meth))
229229

230230
(defn node->data [{:as ctx-in :keys [footnotes]} ^Node node]
231231
(assert (:type ctx-in) ":type must be set on initial doc")
@@ -267,7 +267,7 @@
267267
(if (get-method open-node (class node))
268268
(with-tight-list node
269269
(swap! !ctx open-node node)
270-
(.invoke ^java.lang.reflect.Method @visitChildren-meth this (into-array Object [node]))
270+
(.invoke ^java.lang.reflect.Method visitChildren-meth this (into-array Object [node]))
271271
(swap! !ctx close-node node))
272272
(prn ::not-implemented node))))))
273273

src/nextjournal/markdown/impl/extensions.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
(let [next-non-space (.getNextNonSpaceIndex state)
7676
m (block-formula-delimiter-matcher state)]
7777
(if (re-find m)
78-
(.atIndex (BlockStart/of (into-array [(block-formula-parser)]))
78+
(.atIndex (BlockStart/of (into-array BlockParser [(block-formula-parser)]))
7979
(+ next-non-space (.end m)))
8080
(BlockStart/none)))))))
8181

@@ -94,7 +94,7 @@
9494
(let [next-non-space (.getNextNonSpaceIndex state)
9595
m (block-toc-delimiter-matcher state)]
9696
(if (re-find m)
97-
(.atIndex (BlockStart/of (into-array [(block-toc-parser)]))
97+
(.atIndex (BlockStart/of (into-array BlockParser [(block-toc-parser)]))
9898
(+ next-non-space (.end m)))
9999
(BlockStart/none)))))))
100100

0 commit comments

Comments
 (0)