Fork me on GitHub

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 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?


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


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)


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


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


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


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


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 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.


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.


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