From 6a980e0a537d35d076ecdda2113e194943b6dba4 Mon Sep 17 00:00:00 2001 From: Peter Taoussanis Date: Fri, 18 Nov 2022 10:59:26 +0100 Subject: [PATCH] [fix] [#360] Broken GraalVM compatibility (@borkdude) --- src/taoensso/timbre.cljc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/taoensso/timbre.cljc b/src/taoensso/timbre.cljc index eebadcbf..d81ffc4c 100644 --- a/src/taoensso/timbre.cljc +++ b/src/taoensso/timbre.cljc @@ -752,8 +752,9 @@ ;; Try enable reproducible builds by ensuring that `log!` macro expansion ;; produces deterministic callsite-ids, Ref. #354 #?(:cljs (def ^:private deterministic-rand rand) ; Dummy, non-deterministic - :clj (let [rand ^java.util.Random (java.util.Random. 715873)] - (defn- deterministic-rand [] (.nextDouble rand)))) + :clj (let [;; Must be delayed for GraalVM compatibility, Ref. #360 + rand_ (delay (java.util.Random. 715873))] + (defn- deterministic-rand [] (.nextDouble ^java.util.Random @rand_)))) (defmacro log! ; Public wrapper around `-log!` "Core low-level log macro. Useful for tooling/library authors, etc.