Fork me on GitHub
#clojure-dev
<
2018-07-11
>
mikerod15:07:17

This is a question that is hard to search phrase correctly: There have been issues using a higher version JDK to compile to a lower JRE target. For example using JDK8 javac with target and source set to something lower like 1.7 Here is an example of such a case http://www.draconianoverlord.com/2014/04/01/jdk-compatibility.html My question then relates to how clojure 1.9 and lower, uses ASM to target a lower classfile format. Clj has a 1.6 min, but I think the classfile format is 1.5 (doesn’t matter here necessarily). However, similar to javac, could the resulting bytecode still be invalid on an older jre due to issues like missing classes/base classes etc?

mikerod15:07:00

This is in reference to clj AOT compilation by the way.

bronsa15:07:39

yes if you write code in 1.9 that depends on classes from 1.x you won’t be able to load it in 1.(x-1)

mikerod15:07:46

And I know clj 1.10 is upping the asm and classfile min. Not directly relevant

mikerod15:07:14

Well @bronsa it isn’t that basic I think. Not what I’m trying to explain at least.

mikerod15:07:38

If you see the link I showed. It is things like “hidden” base class dependencies changing and that sort of thing

mikerod15:07:12

Like a somewhat of a “impl detail” in java.reflect causes unexpected bytecode reference differences.

mikerod15:07:33

I know you cannot use newer jre stuff directly and expect it to run on an older jre.

Alex Miller (Clojure team)16:07:37

clojure 1.6 through 1.9 used target jvm 1.6 bytecode clojure 1.10 is now using target jvm 1.8 bytecode

ghadi16:07:49

https://github.com/clojure/clojure/commit/38705b49fd3dbae11e94c576ef49ff3eb1c47395 the .java code was 1.6 target previously, everything else was 1.5

Alex Miller (Clojure team)16:07:28

ah, good call. that was an oversight in clojure 1.6

Alex Miller (Clojure team)16:07:54

in general, javac and jdk are careful about this stuff and clojure is as well, but yes there could be subtle issues due to jdk changes.

mikerod18:07:03

I saw 1.5 with clj 1.9 in aot. But yeah. Makes sense. The subtle JDK issues thing was a bit surprising to me.

mikerod18:07:23

I haven’t seen any problems in clj aot code so far.