clojure-dev

Issues: https://clojure.atlassian.net/browse/CLJ | Guide: https://insideclojure.org/2015/05/01/contributing-clojure/
borkdude 2019-11-07T20:52:44.223100Z

when trying to compile clojure master, I get this error:

compile-clojure:
     [java] Exception in thread "main" java.lang.ExceptionInInitializerError
     [java] 	at clojure.lang.Compile.<clinit>(Compile.java:29)
     [java] Caused by: Syntax error compiling at (clojure/core.clj:7053:1).
     [java] 	at clojure.lang.Compiler.load(Compiler.java:7648)
     [java] 	at clojure.lang.RT.loadResourceScript(RT.java:381)
     [java] 	at clojure.lang.RT.loadResourceScript(RT.java:372)
     [java] 	at clojure.lang.RT.load(RT.java:459)
     [java] 	at clojure.lang.RT.load(RT.java:424)
     [java] 	at clojure.lang.RT.<clinit>(RT.java:338)
     [java] 	... 1 more
     [java] Caused by: java.lang.NumberFormatException: null
     [java] 	at java.base/java.lang.Integer.parseInt(Integer.java:614)
     [java] 	at java.base/java.lang.Integer.valueOf(Integer.java:983)
     [java] 	at clojure.core$eval4288.invokeStatic(core.clj:7065)
     [java] 	at clojure.core$eval4288.invoke(core.clj:7055)
     [java] 	at clojure.lang.Compiler.eval(Compiler.java:7177)
     [java] 	at clojure.lang.Compiler.load(Compiler.java:7636)
     [java] 	... 6 more

borkdude 2019-11-07T20:52:50.223300Z

anyone else seeing this?

borkdude 2019-11-07T20:53:28.223600Z

I'm running mvn package -Dmaven.test.skip=true

alexmiller 2019-11-07T20:54:00.223800Z

did you clean?

borkdude 2019-11-07T20:54:45.224Z

now I did, but same issue

alexmiller 2019-11-07T20:55:03.224300Z

it builds every day here https://build.clojure.org/job/clojure/ - haven't seen any issues

alexmiller 2019-11-07T20:55:24.224600Z

java -version ?

ghadi 2019-11-07T20:56:00.225100Z

what version + jvm @borkdude

alexmiller 2019-11-07T20:56:04.225200Z

build matrix uses 8-11, but I've tested with 12 and 13

borkdude 2019-11-07T20:56:32.225800Z

now it worked. mvn clean didn't work, but rm -rf target did 😕

borkdude 2019-11-07T20:57:16.226400Z

$ java -version
openjdk version "1.8.0_212"
$ mvn -version
Apache Maven 3.6.2 (40f52333136460af0dc0d7232c0dc0bcf0d9e117; 2019-08-27T17:06:16+02:00)

borkdude 2019-11-07T20:57:31.226600Z

thanks.

borkdude 2019-11-07T21:55:08.227700Z

it seems loading clojure.string in spec.alpha can be avoided (it isn't used for anything there)

2019-11-07T21:57:40.229600Z

Regarding your deleted comment of why clojure.string/... works without require'ing clojure.string, IIRC there is a subset (not all) of the namespaces that come with the Clojure JAR that are require'd during init.

alexmiller 2019-11-07T21:57:57.229900Z

you should never rely on that

alexmiller 2019-11-07T21:58:00.230200Z

as they may change

ghadi 2019-11-07T21:58:02.230300Z

^^^

alexmiller 2019-11-07T21:58:05.230500Z

not making any fixes to spec.alpha

borkdude 2019-11-07T21:58:25.230900Z

I'm not saying you should rely on it, but it explains why it works?

alexmiller 2019-11-07T21:58:39.231400Z

require just means to load

ghadi 2019-11-07T21:58:45.231600Z

it happens that clojure.string is required within clojure.core, iirc

alexmiller 2019-11-07T21:58:51.232Z

some namespaces loaded during bootstrap load other stuff

ghadi 2019-11-07T21:58:56.232300Z

but again, that may change

alexmiller 2019-11-07T21:59:04.232600Z

will likely change

ghadi 2019-11-07T21:59:10.232800Z

the only thing you never have to require is clojure.core

borkdude 2019-11-07T21:59:34.233300Z

> it happens that clojure.string is required within clojure.core I don't see that anywhere in core.clj?

2019-11-07T21:59:39.233400Z

you guys are tag-teaming us 🙂

ghadi 2019-11-07T22:00:15.234300Z

that would be a great thing to warn on @borkdude

alexmiller 2019-11-07T22:00:43.235400Z

currently, bootstrap loads clojure.core.server, which loads clojure.string

2019-11-07T22:00:48.235800Z

Some namespaces are created during init other than clojure.core, might be more precise than saying they are require'd.

alexmiller 2019-11-07T22:01:12.236800Z

we have a pending ticket that will avoid loading clojure.core.server (and thus clojure.string) in the case that you don't have socket servers to load

ghadi 2019-11-07T22:01:13.236900Z

clojure.core -> <http://clojure.java.io|clojure.java.io> -> clojure.string is another place

ghadi 2019-11-07T22:01:36.237600Z

where the require happens

alexmiller 2019-11-07T22:02:47.238500Z

if we change the order or set of these requires and your code breaks, I'm going to claim your code was already broken :)

👍 1
borkdude 2019-11-07T22:06:15.239400Z

https://github.com/borkdude/clj-kondo/issues/339

2019-11-07T22:06:31.240200Z

(tongue in cheek) Clojure 1.11 seems due for reminding people that clojure.core/hash values can change across releases

borkdude 2019-11-07T22:07:12.241100Z

@alexmiller that's not why I brought this up. I brought it up because loading namespaces unnecessarily can slow down startup time.

alexmiller 2019-11-07T22:07:27.241700Z

yes, and the point above is - we might improve that in the core :)

borkdude 2019-11-07T22:07:28.241800Z

(although clojure.string would not likely be a huge win)

alexmiller 2019-11-07T22:07:47.242200Z

although compared to loading core, the rest are pretty tiny

alexmiller 2019-11-07T22:08:21.242700Z

we should just add the hash of the release version into all hashes :)

2019-11-07T22:09:28.243500Z

for continuity (or something like that) the hash of mutable Java collections can include the hash of the previous release version 🙂

alexmiller 2019-11-07T22:11:03.244200Z

if you find anything for spec-alpha2, let me know and I'll fix. I think that one was fixed long ago.

borkdude 2019-11-07T22:13:29.244800Z

the reason I looked at this was I tried out a patch for CLJ-1472. some notes here: https://gist.github.com/borkdude/dd0857cf1958b25496fddbdbf359ca59

alexmiller 2019-11-07T22:16:44.245400Z

if the patch doesn't apply, it needs to be rebased over current master. patches drift....

ghadi 2019-11-07T22:34:48.246500Z

@borkdude when you tried CLJ-1472-reentrant-finally2.patch, which program wasn't loadable by Graal native-image?

ghadi 2019-11-07T22:36:05.247500Z

and did you compile spec.alpha, too?

borkdude 2019-11-07T22:36:33.248200Z

@ghadi I updated the notes with the exception I saw during the GraalVM compilation

borkdude 2019-11-07T22:36:45.248700Z

I first compiled clojure, then spec and then clojure using that compiled spec

ghadi 2019-11-07T22:37:30.249300Z

I don't think spec.alpha was compiled with the patched clojure if that error cropped up

alexmiller 2019-11-07T22:38:09.250700Z

you would need to change the spec pom.xml to include the patched clojure

ghadi 2019-11-07T22:38:35.251400Z

yup

ghadi 2019-11-07T22:38:57.251800Z

(the spec.alpha artifact in Maven is AOT compiled, and it contains a locking expr)

borkdude 2019-11-07T22:41:52.252Z

you're right, I made a mistake there

borkdude 2019-11-07T22:42:01.252200Z

I'll retry

borkdude 2019-11-07T23:04:57.253300Z

got rid of that mistake, still same error.

borkdude 2019-11-07T23:05:24.253900Z

I wanted to get leiningen out of the loop, so I tried this: https://gist.github.com/borkdude/dd0857cf1958b25496fddbdbf359ca59#trying-to-compile-only-using-toolsdeps not sure why it can't find the main entrypoint. I'll try some more later, getting late here