Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/tick/core.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@
ldt
(#?(:clj .getOffset :cljs .offset)
(-> (current-zone)
(cljc.java-time.zone-id/get-rules))
^java.time.zone.ZoneRules (cljc.java-time.zone-id/get-rules))
ldt)))
(zoned-date-time [ldt] (cljc.java-time.local-date-time/at-zone ldt (current-zone)))

Expand Down
19 changes: 19 additions & 0 deletions test/tick/reflection_test.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
(ns tick.reflection-test
"tick.core must compile with no reflection warnings, so that a GraalVM
native image of a program that uses tick needs no reflection config."
(:require [clojure.string :as str]
[clojure.test :refer [deftest is]]))

(defn- reflection-warnings
"Recompiles `ns-sym` with *warn-on-reflection* on and returns the
reflection warnings that the compiler printed."
[ns-sym]
(let [err (java.io.StringWriter.)]
(binding [*warn-on-reflection* true
*err* err]
(require ns-sym :reload))
(->> (str/split-lines (str err))
(filter #(str/includes? % "Reflection warning")))))

(deftest tick-core-has-no-reflection
(is (= [] (reflection-warnings 'tick.core))))
Loading