Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clerk doesn't load in java 22 #642

Open
qrthey opened this issue Mar 31, 2024 · 5 comments
Open

Clerk doesn't load in java 22 #642

qrthey opened this issue Mar 31, 2024 · 5 comments

Comments

@qrthey
Copy link

qrthey commented Mar 31, 2024

Java 22 seems to have removed sun.misc.Unsafe.ensureClassInitialized(java.lang.Class) but it is required when loading the nextjournal.clerk namespace (or one of its dependencies). The error specifies that the error occurs during compilation of markdown.clj.

Local setup: Java 22, clojure 1.11.2, clerk 0.15.957 (arch linux, emacs cider 1.14, nREPL 1.1.1)

Can be reproduced by just having the Clerk dependency in deps.edn and evaluating following ns expression:

(ns test-clerk
  (:require [nextjournal.clerk :as clerk]))

The documentation currently states that clerk should work on Java 11 and higher.

edit: Seems to originate from org.graalvm.polyglot used in https://github.com/nextjournal/markdown/blob/main/src/nextjournal/markdown.clj#L7 .

@zampino
Copy link
Collaborator

zampino commented Apr 2, 2024

@qrthey thank you for reporting this! Graal has addressed the removal of sun.misc.Unsafe in java 22. I need to find a version of org.graalvm.js/js which uses the latest truffle api (nextjournal/markdown#23).

@zampino
Copy link
Collaborator

zampino commented Apr 2, 2024

I opened nextjournal/markdown#24 bumping Graal polyglot libraries to support Java 22, but we'll lose support for Java 16 and earlier, the oldest supported would be 17.

@zampino
Copy link
Collaborator

zampino commented Apr 2, 2024

@qrthey as a temporary workaround, to use Java 22 you might use nextjournal/markdown from github source as per

io.github.nextjournal/markdown {:git/sha "6683c48dfdb23404a23057817b6ac3acf0310bca"}

in your project deps.edn (you might need to exclude the jar dependency from clerk if clojure makes troubles resolving deps of different manifest types).

@qrthey
Copy link
Author

qrthey commented Apr 2, 2024

Thanks @zampino . In my daily use of clerk, we are still on java 17. I just stumbled over this when trying some new java 22 stuff.

In general I can see that it might be difficult to force users to upgrade to newer Java versions OR to have them not use the latest version.

@fosskers
Copy link

fosskers commented Apr 4, 2024

io.github.nextjournal/markdown {:git/sha "6683c48dfdb23404a23057817b6ac3acf0310bca"}

Confirmed that this works. I'm able to load Clerk with Java 22.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants