What java version does compile-clj compile to? Is it possible to control that?
https://clojure.github.io/tools.build/clojure.tools.build.api.html#var-compile-clj
you can use :java-opts with ["-target" "8" ,,,] for that
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
you're right
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
Oh cool
but will it mark the file as java 8?
probably
Yes
Current versions of Clojure only emit Java 8 bytecode
Specifically Clojure 1.10-1-12 emits Java 8 bytecode, older emits Java 6 bytecode
We expect to move this baseline in next version after 1.12
Thanks, that is sufficient
Where are you going to move it to? Any gains from that?
Haven’t decided yet
Moving to newer bytecode version gives us access to newer JVM features