Skip to content
Permalink
Browse files

Do the right thing when project is AOT compiled

  • Loading branch information
Bryan Duxbury
Bryan Duxbury committed Jan 29, 2020
1 parent 5e36d77 commit 0ab1c0ee9353afda316d2d5b1449d6721fbe1728
Showing with 7 additions and 3 deletions.
  1. +3 −0 CHANGELOG.md
  2. +2 −1 project.clj
  3. +2 −2 src/com/rpl/nippy_serializable_fn.clj
@@ -0,0 +1,3 @@

# 0.2.0
- Fixed issue with not finding classes by name when project has been AOT compiled
@@ -1,4 +1,4 @@
(defproject com.rpl/nippy-serializable-fns "0.1.0"
(defproject com.rpl/nippy-serializable-fns "0.2.0"
:description "An extension for Nippy that allows freezing and thawing Clojure fns."
:url "https://github.com/redplanetlabs/nippy-serializable-fns"
:dependencies [[org.clojure/clojure "1.10.0"]
@@ -10,5 +10,6 @@
[org.clojure/spec.alpha "0.2.176"]]}
:check {:warn-on-reflection true}
:nrepl {:lein-tools-deps/config {:resolve-aliases [:nrepl]}}
:aot {:aot :all}
}
)
@@ -115,7 +115,7 @@ during interactive development."
^MethodHandle ~accessor-sym
^List (. Collections (singletonList ~afn-sym)))))
accessor-syms)]
(eval `(let [~klass-sym (Class/forName ~class-name)
(eval `(let [~klass-sym (clojure.lang.RT/classForName ~class-name)
~@accessor-lookups]
(fn [~afn-sym ~data-output-sym]
(nippy/freeze-to-out! ~data-output-sym ~class-name)
@@ -172,7 +172,7 @@ during interactive development."
)

(defn- mk-deserializer-for-anon-fn [class-name]
(let [klass (Class/forName class-name)
(let [klass (clojure.lang.RT/classForName class-name)
fields (fields-to-serialize ^Class klass)
read-fields-into-array (eval (gen-read-n-fields (count fields)))
field-types (mapv #(.getType ^Field %) fields)

0 comments on commit 0ab1c0e

Please sign in to comment.
You can’t perform that action at this time.