Fork me on GitHub
#clojure
<
2024-04-28
>
m3tti05:04:18

i've currently the problem that i can't build with deps.edn based project. My uberjar task doesn't compile. So it throws an error during the compile phase. The error itself doesn't say a lot sadly 😕

Execution error (ExceptionInfo) at clojure.tools.build.tasks.compile-clj/compile-clj (compile_clj.clj:114).
Does anybody know what could be the problem? Furthermore the class files are also not generated. I've added the gen-class stuff to my main namespace 😕

Alex Miller (Clojure team)06:04:36

Can you provide the command you ran, the build.clj and the full output?

m3tti06:04:36

build.clj

(ns build
  (:require [clojure.tools.build.api :as b]))

(def version (format "1.2.%s" (b/git-count-revs nil)))
(def class-dir "target/classes")
(def uber-file (format "target/%s-%s-standalone.jar" "jobplatform" version))

;; delay to defer side effects (artifact downloads)
(def basis (delay (b/create-basis {:project "deps.edn"})))

(defn clean [_]
  (b/delete {:path "target/classes"}))

(defn uber [_]
  (clean nil)
  (b/copy-dir {:src-dirs ["resources"]
               :target-dir class-dir})
  (b/compile-clj {:basis basis
                  :src-dirs ["src"]
                  :class-dir class-dir})
  (b/uber {:class-dir class-dir
           :uber-file uber-file
           :basis basis
           :main 'jobplatform.core}))
The full outbut after clojure -T:build uber
* run-java-tool was invoked directly
* run-java-tool should only be used via symlinks to it
Execution error (ExceptionInfo) at clojure.tools.build.tasks.compile-clj/compile-clj (compile_clj.clj:114).
Clojure compilation failed, working dir preserved: /tmp/compile-clj11458567838255310607

Full report at:
/tmp/clojure-5265600849608910499.edn
The edn.
{:clojure.main/message
 "Execution error (ExceptionInfo) at clojure.tools.build.tasks.compile-clj/compile-clj (compile_clj.clj:114).\nClojure compilation failed, working dir preserved: /tmp/compile
-clj11458567838255310607\n",
 :clojure.main/triage
 {:clojure.error/class clojure.lang.ExceptionInfo,
  :clojure.error/line 114,
  :clojure.error/cause
  "Clojure compilation failed, working dir preserved: /tmp/compile-clj11458567838255310607",
  :clojure.error/symbol
  clojure.tools.build.tasks.compile-clj/compile-clj,
  :clojure.error/source "compile_clj.clj",
  :clojure.error/phase :execution},
 :clojure.main/trace
 {:via
  [{:type clojure.lang.ExceptionInfo,
    :message
    "Clojure compilation failed, working dir preserved: /tmp/compile-clj11458567838255310607",
    :data {},
    :at
    [clojure.tools.build.tasks.compile_clj$compile_clj
     invokeStatic
     "compile_clj.clj"
     114]}],
  :trace
  [[clojure.tools.build.tasks.compile_clj$compile_clj
    invokeStatic
    "compile_clj.clj"
    114]
   [clojure.tools.build.tasks.compile_clj$compile_clj
    invoke
    "compile_clj.clj"
    82]
   [clojure.lang.Var invoke "Var.java" 384]
   [clojure.tools.build.api$compile_clj invokeStatic "api.clj" 317]
   [clojure.tools.build.api$compile_clj invoke "api.clj" 277]
   [build$uber invokeStatic "build.clj" 18]
   [build$uber invoke "build.clj" 14]
   [clojure.lang.Var invoke "Var.java" 384]
   [clojure.run.exec$exec invokeStatic "exec.clj" 89]
   [clojure.run.exec$exec invoke "exec.clj" 78]
   [clojure.run.exec$_main$fn__220 invoke "exec.clj" 228]
   [clojure.run.exec$_main invokeStatic "exec.clj" 224]
   [clojure.run.exec$_main doInvoke "exec.clj" 192]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.lang.Var applyTo "Var.java" 705]
   [clojure.core$apply invokeStatic "core.clj" 667]
   [clojure.main$main_opt invokeStatic "main.clj" 514]
   [clojure.main$main_opt invoke "main.clj" 510]
   [clojure.main$main invokeStatic "main.clj" 664]
   [clojure.main$main doInvoke "main.clj" 616]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.lang.Var applyTo "Var.java" 705]
   [clojure.main main "main.java" 40]],
  :cause
  "Clojure compilation failed, working dir preserved: /tmp/compile-clj11458567838255310607",
  :data {}}}

m3tti06:04:07

Funny part is that there is no class files and even the copy of the resource folder isn't in the target folder 😕

m3tti06:04:32

with lein the uberjar build works. BUT i wanted to give that method a try cause afaik its the new official way right?

m3tti06:04:50

i've a compojure ring app with run/jetty in it and the wrap-reload middleware

m3tti06:04:33

and doing a (compile 'jobplatform.core) leads to

Syntax error macroexpanding clojure.core/ns at (jobplatform/core.clj:1:1).
No such file or directory

p-himik07:04:58

The very last error is probably because the classes directory is missing. Not the target/classes that your build.clj mentions, but the value of *compile-path*, which by default is just "classes".

m3tti08:04:26

Yeah but i have no clue :/ switched to lein and everything works great :/ maybe i'm just to dumb xD

p-himik08:04:07

An explicit call to compile won't work with Lein just as well, because it's not about your tools but rather about how compile works.

m3tti08:04:58

Ah good to know. You know last time i was investibg into clojure like 5 or 6 years ago there was only lein :D just wanted to expand my knowledge and get back to awesome lisp development

p-himik08:04:33

These lines in the output seem to be crucial:

* run-java-tool was invoked directly
* run-java-tool should only be used via symlinks to it
They are not from tools.build, they're from your Java wrapper. And e.g. https://gitweb.gentoo.org/proj/eselect-java.git/tree/src/scripts/run-java-tool.bash.in?id=2b7d0f087f3fdec791a4667512ecfe71f64a9ffd exits with non-0 status after printing those lines. So the issue seems to be your Java setup. As for why it works with Lein - I don't know how it works but either it doesn't use that Java command or it uses the Java process where it was launched. Probably the former. The way tools.build determines the Java command to use if you don't explicitly specify :java-cmd for compile-clj is, in order: 1. The JAVA_CMD env var 2. java in PATH 3. bin/java under JAVA_HOME That should give you enough info to be able to fix the problem.

m3tti09:04:18

Oh ok i'm on gentoo currently

m3tti09:04:47

Btw whats the current state of the art build wise still leiningen or is it allready boot or deps.edn

Alex Miller (Clojure team)14:04:09

What's in /tmp/clojure-5265600849608910499.edn ?

Alex Miller (Clojure team)14:04:32

I don't think the java thing is an issue or it wouldn't have run at all

p-himik15:04:09

The EDN was posted above. Pretty sure it is the issue since the run-java-tool wrapper uses exit 1. Seems the main process was run with one version of Java but compile-clj tried to use that wrapper.

Alex Miller (Clojure team)15:04:02

I guess, can also set :java-cmd on the compile-clj task to a specific path to the java executable if needed

m3tti15:04:27

ok after setting JAVA_CMD or JAVA_HOME the build is complaining that it can't find clojure.main

m3tti15:04:35

even if i add it as dep

Alex Miller (Clojure team)15:04:12

can you share the actual output

m3tti15:04:29

❯ JAVA_HOME=/opt/openjdk-bin-17.0.10_p7/bin/javac JAVA_CMD=/usr/bin/java clojure -T:build uber
Error: Could not find or load main class clojure.main
Caused by: java.lang.ClassNotFoundException: clojure.main
Execution error (ExceptionInfo) at clojure.tools.build.tasks.compile-clj/compile-clj (compile_clj.clj:114).
Clojure compilation failed, working dir preserved: /tmp/compile-clj3444501778209445454

Full report at:
/tmp/clojure-15222711653787284576.edn

m3tti15:04:08

{:clojure.main/message
 "Execution error (ExceptionInfo) at clojure.tools.build.tasks.compile-clj/compile-clj (compile_clj.clj:114).\nClojure compilation failed, working dir preserved: /tmp/compile-clj3444501778209445454\n",
 :clojure.main/triage
 {:clojure.error/class clojure.lang.ExceptionInfo,
  :clojure.error/line 114,
  :clojure.error/cause
  "Clojure compilation failed, working dir preserved: /tmp/compile-clj3444501778209445454",
  :clojure.error/symbol
  clojure.tools.build.tasks.compile-clj/compile-clj,
  :clojure.error/source "compile_clj.clj",
  :clojure.error/phase :execution},
 :clojure.main/trace
 {:via
  [{:type clojure.lang.ExceptionInfo,
    :message
    "Clojure compilation failed, working dir preserved: /tmp/compile-clj3444501778209445454",
    :data {},
    :at
    [clojure.tools.build.tasks.compile_clj$compile_clj
     invokeStatic
     "compile_clj.clj"
     114]}],
  :trace
  [[clojure.tools.build.tasks.compile_clj$compile_clj
    invokeStatic
    "compile_clj.clj"
    114]
   [clojure.tools.build.tasks.compile_clj$compile_clj
    invoke
    "compile_clj.clj"
    82]
   [clojure.lang.Var invoke "Var.java" 384]
   [clojure.tools.build.api$compile_clj invokeStatic "api.clj" 317]
   [clojure.tools.build.api$compile_clj invoke "api.clj" 277]
   [build$uber invokeStatic "build.clj" 18]
   [build$uber invoke "build.clj" 14]
   [clojure.lang.Var invoke "Var.java" 384]
   [clojure.run.exec$exec invokeStatic "exec.clj" 89]
   [clojure.run.exec$exec invoke "exec.clj" 78]
   [clojure.run.exec$_main$fn__220 invoke "exec.clj" 228]
   [clojure.run.exec$_main invokeStatic "exec.clj" 224]
   [clojure.run.exec$_main doInvoke "exec.clj" 192]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.lang.Var applyTo "Var.java" 705]
   [clojure.core$apply invokeStatic "core.clj" 667]
   [clojure.main$main_opt invokeStatic "main.clj" 514]
   [clojure.main$main_opt invoke "main.clj" 510]
   [clojure.main$main invokeStatic "main.clj" 664]
   [clojure.main$main doInvoke "main.clj" 616]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.lang.Var applyTo "Var.java" 705]
   [clojure.main main "main.java" 40]],
  :cause
  "Clojure compilation failed, working dir preserved: /tmp/compile-clj3444501778209445454",
  :data {}}}

m3tti15:04:49

same error if i use only one of the vars

Alex Miller (Clojure team)15:04:37

can you post the /tmp/compile-clj3444501778209445454/compile.args file

m3tti16:04:48

/usr/bin/java -cp /tmp/compile-clj3444501778209445454/compile-clj:target/classes clojure.main /tmp/compile-clj3444501778209445454/compile.clj

Alex Miller (Clojure team)18:04:36

that is the actual command being run during the compile, you should be able to run it from your project directory at the terminal, not sure you will see anything different, but you could try that

Alex Miller (Clojure team)18:04:31

the error makes it seem like clojure is not on the classpath, but I'm not sure how that would be happening. I guess I'm assuming your deps.edn is a typical deps.edn file

m3tti18:04:37

{:paths ["src"]
 :deps
 { compojure/compojure { :mvn/version "1.7.1"}
   ring/ring-core { :mvn/version "1.12.1"}
   ring/ring-devel { :mvn/version "1.12.1"}
   com.github.seancorfield/next.jdbc {:mvn/version "1.3.925"}
   com.h2database/h2 {:mvn/version "2.2.224"}
   hiccup/hiccup {:mvn/version "2.0.0-RC3"}
   org.clojure/data.zip {:mvn/version "1.1.0"}
   ring/ring-jetty-adapter { :mvn/version "1.8.2"}}
 :aliases
 {;; Run with clj -T:build function-in-build
  :build {:deps {io.github.clojure/tools.build {:git/tag "v0.10.0" :git/sha "3a2c484"}}
          :ns-default build}}}

m3tti18:04:05

is there some example project for a hello world somewhere?

m3tti18:04:10

for the clojure command i just did the install-linux.sh thing

m3tti18:04:22

can i reset that somehow maybe there was an issue

Alex Miller (Clojure team)18:04:33

I don't see any reason to believe that's an issue

Alex Miller (Clojure team)18:04:52

can you run the command above? or push up this project to git or something

m3tti18:04:49

i guess i can upload the hello world thing i did besides that that also doesn't work maybe my java installation doesn't work

m3tti18:04:05

correctly but i don't understand why lein is than working for me

seancorfield20:04:10

You have:

> JAVA_HOME=/opt/openjdk-bin-17.0.10_p7/bin/javac JAVA_CMD=/usr/bin/java ...
but JAVA_HOME should be a folder and, generally, JAVA_CMD is going to identify the java command within that specific version install so I'd expect either:
> JAVA_HOME=/opt/openjdk-bin-17.0.10_p7 ...
or
> JAVA_CMD=/opt/openjdk-bin-17.0.10_p7/bin/java ...
(note: /bin/java not /bin/javac for the CMD)

m3tti21:04:45

i have tried it either way and you are right they java_home javac path was wrong in my paste but i undid that and came to the same clojure.main class not found exception sadly 😕 i don't get it why lein works and deps.edn not 😕 i want to use deps.edn 😄 somehow.

p-himik21:04:55

A good opportunity to learn the basics of tracing tools, if you're up for it. :) I'd look any sort of top (`top`, htop, btop, etc.) what exactly lein launches (easier if you put (Thread/sleep 1000000) somewhere). Or use strace with a filter for any syscalls that launch subprocesses. Learning how to view some the env of some process is also useful. All that is pretty basic stuff, easy to look up, even easier with LLMs. And in my case, it's enough to figure out what the hell is going on in around 80% of the cases.

p-himik21:04:34

My guess is that lein uses the same exact executable with maybe the same exact env that was used to launch its main process.

Alex Miller (Clojure team)21:04:54

I’ll ask again - can you run the command in compile.args? If that doesn’t work, what do you get?

m3tti22:04:03

Error: Could not find or load main class clojure.main
Caused by: java.lang.ClassNotFoundException: clojure.main

m3tti22:04:07

thats what i get

Alex Miller (Clojure team)22:04:38

So somehow the classpath does not include your deps

Daniel01:04:37

Don't you need to deref your basis? I see a similar error when using delay without the deref.

Alex Miller (Clojure team)01:04:05

That’s probably something I can add a check for

m3tti05:04:09

what do you mean by deref?

seancorfield05:04:03

@basis instead of basis -- look closely at your build.clj and at the guide on http://clojure.org that was linked above.

seancorfield05:04:44

@ = deref -- since you have (delay ..) in your basis def, you need to deref the delay in order to get the underlying value.

m3tti05:04:01

oh my god it was a compination now it works thanks so much guys

m3tti05:04:09

so to sum up. On gentoo or any distro that uses run-java-tool you have to set the java runtime as env either JAVA_HOME or in my case JAVA_CMD and as @U04V70XH6 mentioned you have to use @basis in the edn file. I was confused cause on the internet there was plenty of other stuff too. So add your JAVA_CMD and follow the official docs guys. Thanks again

p-himik05:04:31

> On gentoo or any distro that uses run-java-tool you have to set the java runtime as env either JAVA_HOME or in my case JAVA_CMD This doesn't sound right, given how tools.build searches for Java. Are you sure your env in a new shell doesn't include any JAVA_ variables?

seancorfield05:04:53

You may see examples of build.clj that do not have the delay on computing the basis -- in which case those wouldn't deref it at use. Personally, I tend to create the basis inside a function: https://github.com/seancorfield/honeysql/blob/develop/build.clj#L86-L96 and just call that where I specifically need options with a :basis key.

m3tti05:04:03

i'll check one minute btw thank you too @U2FRKM4TW and @U064X3EF3

m3tti05:04:47

declare -x JAVAC="/home/metti/.gentoo/java-config-2/current-user-vm/bin/javac" thats what there is only

p-himik05:04:02

What does env | grep JAVA output?

m3tti05:04:05

and what the clojure script does is it uses type -p java which on gentoo gives you the /usr/bin/java which is basically a symlink to run-java-tool

m3tti05:04:44

❯ env | grep JAVA
JAVAC=/home/metti/.gentoo/java-config-2/current-user-vm/bin/javac

p-himik05:04:53

> which on gentoo gives you the /usr/bin/java which is basically a symlink to run-java-tool That's perfectly fine because run-java-tool specifically asks to be run via a symlink. But somehow it's being used directly.

m3tti05:04:44

and setting only JAVA_HOME didn't work either cause it the type command is first

m3tti05:04:51

@U2FRKM4TW thats right thats strange

p-himik05:04:01

You can also try running your build process in a way that results in that run-java-tool error with (into {} (filter #(clojure.string/starts-with? (key %) "JAVA")) (System/getenv)) printed somewhere inside the script and see what it outputs. Just in case.

m3tti06:04:45

{JAVAC /home/metti/.gentoo/java-config-2/current-user-vm/bin/javac}
Thats all there is than 😕 if i run it

m3tti06:04:39

whats strange is that doesn't the emacs cider mode use clojure to initialize the repl? Cause there everything just works fine.

p-himik06:04:13

REPL has nothing to do with all this.

m3tti06:04:31

ah ok i see guess its due to the compilation of the code? that you need the right executable than?

p-himik06:04:39

No, it's just a combination of that wrapper on Gentoo being very strict with how it's called (for seemingly a good reason - the existence of the wrapper should be left as an implementation detail, nobody should rely on the wrapper directly), and tools.build using .getCanonicalPath, nothing more to that particular error.

1
bbloom16:04:52

Am I crazy, or did the reader used to add line and column metadata to all metadata-having forms? I'm looking at the code now and only see that metadata being added to lists...

Alex Miller (Clojure team)16:04:08

don't think anything has changed for that

p-himik16:04:06

There's a chance you're thinking about some tool that does that, e.g. Clerk, like described here: https://clojurians.slack.com/archives/C66EM8D5H/p1713893176618759

bbloom16:04:13

ok, so i'm crazy. got it 😛

bbloom16:04:18

including that metadata on symbols seems like it might be a nice small enhancement

lread16:04:06

@U053S2W0V I have vague memories of being confused by this a while ago... You experiencing this?:

$ clj
Clojure 1.11.3
user=> (meta '(1 2 3))
{:line 1, :column 8}
Some elaboration https://github.com/clojure/tools.reader?tab=readme-ov-file#rationale: > Moreover, by using reader types from clojure.tools.reader.reader-types, if using an IndexingReader, column info is available and both line and column metadata is attached not only to lists, but to symbols, vectors and maps too, when additional debugging info is needed (note that the edn reader doesn't add any line/column metadata at all).

bbloom17:04:35

aaaah yeah, tools.reader does this

bbloom17:04:44

with clojure's default reader:

bbloom17:04:10

user=> (map (juxt identity meta) (tree-seq sequential? seq '(1 [x (y)])))
([(1 [x (y)]) {:line 1, :column 71}]
 [1 nil]
 [[x (y)] nil]
 [x nil]
 [(y) {:line 1, :column 77}]
 [y nil])

bbloom17:04:52

was expecting to see meta on anything that satisfies IMeta, but was hoping to see it on the symbols at least

1
flowthing19:04:53

I agree this would be useful. There's an Ask about this: https://ask.clojure.org/index.php/13314/location-data-on-all-iobj

👍 1
flowthing19:04:31

The changes in Clojure 1.12 don't affect the way protocols are extended to primitive types such as byte arrays, right? That is, I will still have to do the Class/forName thing:

(extend-protocol Writable
  (Class/forName "[B")
  (write [this ^OutputStream out]
    ...))

flowthing19:04:53

Oh, it seems it does and I can use byte/1 instead, and the ordering no longer matters. 🙌

🎉 2
dpsutton22:04:12

What do you mean ordering?

flowthing04:04:58

λ clj -Srepro -M -r
Clojure 1.11.1
user=> (defprotocol P (m [this]))
P
user=> (extend-protocol P (Class/forName "[B") (m [_] :b) String (m [_] :s))
nil
user=> (extend-protocol P String (m [_] :s) (Class/forName "[B") (m [_] :b))
Syntax error (IllegalArgumentException) compiling at (REPL:1:1).
Don't know how to create ISeq from: java.lang.Character

flowthing04:04:13

Clojure 1.12.0-alpha10
user=> (defprotocol P (m [this]))
P
user=> (extend-protocol P String (m [_] :s) byte/1 (m [_] :b))
nil
user=>

p-himik22:04:02

Well this is awkward (started in this https://ask.clojure.org/index.php/13854/inst-changes-old-dates-in-clojure-1-12-alpha10):

Clojure 1.12.0-alpha10
user=> (.getTime #inst "1582-02-24")
-12237696000000
user=> (let [d #inst "1582-02-24"] (.getTime d))
-12237696000000
user=> (do (def d #inst "1582-02-24") (.getTime d))
-12238560000000

4
p-himik22:04:17

In the top form the string is read as a date, then converted to a different string (the bottom arrow), then read again.

p-himik22:04:21

Right, and that second printing is different in 1.12.0 from the original input due to how printing of dates is implemented.

Jason Bullers23:04:01

Is it just a Clojure printing thing or does Java do something weird too?

Jason Bullers23:04:56

I've never tried playing with dates around Gregorian calendar inception 😅

Jason Bullers23:04:52

FWIW in Java I get (almost) the last result (different because of time zone I assume)

Jason Bullers23:04:10

I don't know what's up with the first two numbers

Alex Miller (Clojure team)01:04:22

the only thing that has changed is printing, but we'll take a look

oyakushev05:04:02

I get -12238560000000 in all three cases.

p-himik05:04:14

Forgot to add - Java 21.0.3. @U06PNK4HG On 1.12.0-alpha10?

oyakushev06:04:33

Still the same with JDK21 and 22, 1.11.3 and 1.12.0-alpha10. MacOS, en_US.UTF-8

oyakushev06:04:22

Same in Docker

p-himik06:04:13

So I assume you also get this with all combinations?

user=> #inst "1582-02-24"
#inst "1582-02-24T00:00:00.000-00:00"
whereas I get this:
Clojure 1.12.0-alpha10
user=> #inst "1582-02-24"
#inst "1582-03-06T00:00:00.000-00:00"

Clojure 1.11.3
user=> #inst "1582-02-24"
#inst "1582-02-24T00:00:00.000-00:00"

oyakushev06:04:29

Yes, always #inst "1582-02-24T00:00:00.000-00:00"

p-himik06:04:07

Weird. Here's a full unabridged reproduction. Does it also output 1582-02-24 for you? (Should be fine to use docker instead of podman if that's what you usually use).

$ podman run -it --rm eclipse-temurin:21-jdk bash
root@b88b07e2634a:/# curl -L -O 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  1864  100  1864    0     0   1197      0  0:00:01  0:00:01 --:--:--     0
root@b88b07e2634a:/# chmod +x linux-install.sh
root@b88b07e2634a:/# ./linux-install.sh
Downloading and expanding tar
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 14.4M  100 14.4M    0     0  4534k      0  0:00:03  0:00:03 --:--:-- 7157k
Installing libs into /usr/local/lib/clojure
Installing clojure and clj into /usr/local/bin
Installing man pages into /usr/local/share/man/man1
Removing download
Use clj -h for help.
root@b88b07e2634a:/# clojure -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.12.0-alpha10"}}}' -M -r
Downloading: org/clojure/clojure/1.12.0-alpha10/clojure-1.12.0-alpha10.pom from central
Downloading: org/clojure/spec.alpha/0.3.218/spec.alpha-0.3.218.pom from central
Downloading: org/clojure/core.specs.alpha/0.2.62/core.specs.alpha-0.2.62.pom from central
Downloading: org/clojure/pom.contrib/1.1.0/pom.contrib-1.1.0.pom from central
Downloading: org/clojure/spec.alpha/0.3.218/spec.alpha-0.3.218.jar from central
Downloading: org/clojure/core.specs.alpha/0.2.62/core.specs.alpha-0.2.62.jar from central
Downloading: org/clojure/clojure/1.12.0-alpha10/clojure-1.12.0-alpha10.jar from central
Clojure 1.12.0-alpha10
user=> #inst "1582-02-24"
#inst "1582-03-06T00:00:00.000-00:00"
user=>

oyakushev07:04:55

Alright, that finally worked

oyakushev07:04:09

Right, sorry, in Docker I only tested with 1.11.1 before

p-himik07:04:38

Still weird that you got a different result outside of Docker. Just in case, not from Docker:

$ clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.12.0-alpha10"}}}' -M -r
Clojure 1.12.0-alpha10
user=> #inst "1582-02-24"
#inst "1582-03-06T00:00:00.000-00:00"
user=> (str (java.util.Calendar/getInstance))
"java.util.GregorianCalendar[time=1714374246288,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"Asia/Nicosia\",offset=7200000,dstSavings=3600000,useDaylight=true,transitions=128,lastRule=java.util.SimpleTimeZone[id=Asia/Nicosia,offset=7200000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2024,MONTH=3,WEEK_OF_YEAR=18,WEEK_OF_MONTH=5,DAY_OF_MONTH=29,DAY_OF_YEAR=120,DAY_OF_WEEK=2,DAY_OF_WEEK_IN_MONTH=5,AM_PM=0,HOUR=10,HOUR_OF_DAY=10,MINUTE=4,SECOND=6,MILLISECOND=288,ZONE_OFFSET=7200000,DST_OFFSET=3600000]"

oyakushev07:04:51

I found the culprit. If I use rebel-readline, it always renders as 1582-02-24.... But without it, I get the same behavior as you

p-himik07:04:28

Huh. Why would it override printing of insts?..

oyakushev07:04:12

It's a bit deeper than printing. Or it is about printing, but in the end it influences the #=() expression.

oyakushev07:04:47

user=> (decompile #inst "1582-02-24")

...
    public static void __init0() {
        const__0 = RT.readString("#inst \"1582-03-26T00:00:00.000-00:00\"");
    }
...

oyakushev07:04:15

Funny that if you try to decompile that, the read date drifts even further:

(decompile (.getTime #inst "1582-03-26T00:00:00.000-00:00"))

...
    public static void __init0() {
        const__0 = RT.readString("#inst \"1582-04-25T00:00:00.000-00:00\"");
    }
...
Seems like Clojure is doing a Julian/Gregorian conversion or something in the print-read roundtrip

p-himik07:04:48

Yeah, it's mentioned in the Ask I link to in the OP.

👍 1
oyakushev08:04:21

Yeah, reading is hard.

Jason Bullers13:04:05

jdk21 👆:skin-tone-2: