This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-04-18
Channels
- # babashka (12)
- # beginners (35)
- # biff (6)
- # calva (23)
- # cider (7)
- # clj-kondo (10)
- # cljs-dev (15)
- # clojure (81)
- # clojure-dev (2)
- # clojure-europe (13)
- # clojure-germany (1)
- # clojure-korea (2)
- # clojure-nl (1)
- # clojure-norway (19)
- # clojure-uk (7)
- # clojurescript (23)
- # core-typed (33)
- # cursive (7)
- # data-science (7)
- # datalevin (9)
- # hyperfiddle (1)
- # introduce-yourself (2)
- # malli (1)
- # matrix (17)
- # missionary (24)
- # music (1)
- # off-topic (15)
- # polylith (6)
- # reagent (10)
- # releases (5)
- # remote-jobs (1)
- # shadow-cljs (3)
- # squint (7)
- # xtdb (11)
- # yamlscript (6)
👋 Hello people!
In the company I work, we are migrating our services to Java 21. Yesterday we had a production issue because one of the services where using something like (Thread/sleep (get-from-json-config config))
This code works until Java 17, but with Java 21 it fails because sleep can receive a long
or a Duration
now. We are already using clj-kondo in the pipeline, but the reflection warning is off, and we wouldn't like to turn it on for all cases for while. Is there a way I can check only these specific reflection cases related with Thread/sleep?
when you say "it fails", what do you mean?
I guess lavh means: reflection happens. Not sure what the failure is though. With native-image this can cause an issue
yes, should become reflective. I was not thinking of native-image though, that makes sense
presumably adding the ^long type hint should resolve and works in both older and newer jdks
related: https://ask.clojure.org/index.php/12853/built-in-function-for-thread-sleep-to-avoid-type-hints
This sort of thing is why we have (set! *warn-on-reflection* true)
in every file and we fail CI if a) a new file is added without that line or b) a new reflection warning in our own code appears... Stricter than you're talking about but it caught all the Thread/sleep
issues when we updated past JDK 17...