tools-build

roklenarcic 2024-08-13T10:35:59.070169Z

What java version does compile-clj compile to? Is it possible to control that?

Kirill Chernyshov 2024-08-13T11:13:32.557159Z

https://clojure.github.io/tools.build/clojure.tools.build.api.html#var-compile-clj you can use :java-opts with ["-target" "8" ,,,] for that

roklenarcic 2024-08-13T11:35:23.648899Z

those opts affect javac and looking at the source, compile-clj will invoke java with clojure.main that executes a script generated on the fly, that calls clojure.core/compile a bunch. And I assume that always produces class files in the version of the current JVM

Kirill Chernyshov 2024-08-13T11:47:40.271439Z

you're right

souenzzo 2024-08-13T11:48:12.435309Z

It is not about compile-clj, it is in clojure.core. Clojure uses a Java library to emit it's bytecode: asm2 And it has no options to support more than one version Currently, it dont use any asm operation that is not supported by jvm1.8

roklenarcic 2024-08-13T11:48:26.742459Z

Oh cool

roklenarcic 2024-08-13T11:48:40.157119Z

but will it mark the file as java 8?

roklenarcic 2024-08-13T11:48:43.612229Z

probably

Alex Miller (Clojure team) 2024-08-13T11:59:58.260269Z

Yes

Alex Miller (Clojure team) 2024-08-13T12:00:30.967179Z

Current versions of Clojure only emit Java 8 bytecode

Alex Miller (Clojure team) 2024-08-13T12:01:17.152219Z

Specifically Clojure 1.10-1-12 emits Java 8 bytecode, older emits Java 6 bytecode

Alex Miller (Clojure team) 2024-08-13T12:01:48.485319Z

We expect to move this baseline in next version after 1.12

roklenarcic 2024-08-13T12:02:00.757609Z

Thanks, that is sufficient

roklenarcic 2024-08-13T12:02:15.950669Z

Where are you going to move it to? Any gains from that?

Alex Miller (Clojure team) 2024-08-13T12:02:50.954699Z

Haven’t decided yet

Alex Miller (Clojure team) 2024-08-13T12:03:23.744829Z

Moving to newer bytecode version gives us access to newer JVM features