[#112] PR housekeeping
This commit is contained in:
parent
67dde8d7bd
commit
c83572f0a8
1 changed files with 26 additions and 16 deletions
|
|
@ -905,17 +905,20 @@
|
||||||
(write-bytes-md out cname-ba)))
|
(write-bytes-md out cname-ba)))
|
||||||
|
|
||||||
(-freeze-without-meta! (into {} x) out)))
|
(-freeze-without-meta! (into {} x) out)))
|
||||||
|
|
||||||
(freezer IType
|
(freezer IType
|
||||||
(let [aclass (class x)
|
(let [aclass (class x)
|
||||||
cname (.getName aclass)]
|
cname (.getName aclass)]
|
||||||
(write-id out id-type)
|
(write-id out id-type)
|
||||||
(-freeze-without-meta! cname out)
|
(write-str out cname)
|
||||||
(let [basis-method (.getMethod aclass "getBasis" nil)
|
(let [basis-method (.getMethod aclass "getBasis" nil)
|
||||||
basis (.invoke basis-method nil nil)]
|
basis (.invoke basis-method nil nil)]
|
||||||
(doseq [b basis]
|
(-run!
|
||||||
(let [^Field cfield (.getField aclass (name b))]
|
(fn [b]
|
||||||
(let [fvalue (.get cfield x)]
|
(let [^Field cfield (.getField aclass (name b))]
|
||||||
(-freeze-without-meta! fvalue out)))))))
|
(let [fvalue (.get cfield x)]
|
||||||
|
(-freeze-without-meta! fvalue out))))
|
||||||
|
basis))))
|
||||||
|
|
||||||
(freezer Object
|
(freezer Object
|
||||||
(when-debug (println (str "freeze-fallback: " (type x))))
|
(when-debug (println (str "freeze-fallback: " (type x))))
|
||||||
|
|
@ -1122,16 +1125,23 @@
|
||||||
|
|
||||||
(defn- read-type [in class-name]
|
(defn- read-type [in class-name]
|
||||||
(try
|
(try
|
||||||
(let [aclass (clojure.lang.RT/classForName class-name)
|
(let [aclass (clojure.lang.RT/classForName class-name)
|
||||||
basis-method (.getMethod aclass "getBasis" nil)
|
nbasis
|
||||||
basis (.invoke basis-method nil nil)
|
(let [basis-method (.getMethod aclass "getBasis" nil)
|
||||||
cvalues (object-array (count basis))
|
basis (.invoke basis-method nil nil)]
|
||||||
ctors (.getConstructors aclass)
|
(count basis))
|
||||||
^Constructor ctor (aget ctors 0) ;; Is this safe?
|
|
||||||
]
|
cvalues (object-array nbasis)]
|
||||||
(dotimes [i (count basis)]
|
|
||||||
(aset cvalues i (thaw-from-in! in)))
|
(enc/reduce-n
|
||||||
(.newInstance ctor (into-array Object cvalues)))
|
(fn [_ i] (aset cvalues i (thaw-from-in! in)))
|
||||||
|
nil nbasis)
|
||||||
|
|
||||||
|
(let [ctors (.getConstructors aclass)
|
||||||
|
^Constructor ctor (aget ctors 0) ; Impl. detail? Ref. https://goo.gl/XWmckR
|
||||||
|
]
|
||||||
|
(.newInstance ctor cvalues)))
|
||||||
|
|
||||||
(catch Exception e
|
(catch Exception e
|
||||||
{:type :type
|
{:type :type
|
||||||
:throwable e
|
:throwable e
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue