Recently I’ve had users of my libraries start reporting mysterious errors due to a missing reference to SequencedCollection, a Java interface added in JDK 21:

Execution error (ClassNotFoundException) at
jdk.internal.loader.BuiltinClassLoader/loadClass (BuiltinClassLoader.java:641).
java.util.SequencedCollection

Specifically, projects using Jepsen 0.3.5 started throwing this error due to Clojure’s built-in rrb_vector.clj, which is particularly vexing given that the class doesn’t reference SequencedCollection at all.

It turns out that the Clojure compiler, when run on JDK 21 or later, will automatically insert references to this class when compiling certain expressions–likely because it now appears in the supertypes of other classes. Jepsen had :javac-options ["-source" "11" "-target" "11"] in Jepsen’s project.clj already, but it still emitted references to SequencedCollection because the reference is inserted by the Clojure compiler, not javac. Similarly, adding ["--release" "11"] didn’t work.

Long story short: as far as I can tell the only workaround is to downgrade to Java 17 (or anything prior to 21) when building Jepsen as a library. That’s not super hard with update-alternatives, but I still imagine I’ll be messing this up until Clojure’s compiler can get a patch.

Post a Comment

Comments are moderated. Links have nofollow. Seriously, spammers, give it a rest.

Please avoid writing anything here unless you're a computer. This is also a trap:

Supports Github-flavored Markdown, including [links](http://foo.com/), *emphasis*, _underline_, `code`, and > blockquotes. Use ```clj on its own line to start an (e.g.) Clojure code block, and ``` to end the block.