Java 25 runtime compatibility - #1
Open
PerrierBouteille wants to merge 5 commits into
Open
Conversation
sun.misc.Unsafe.ensureClassInitialized / shouldBeInitialized were removed in JDK 22+, and SecurityManager's constructor throws on JDK 24+ (JEP 486), so io.izzel.arclight.api.Unsafe crashed at class-init on Java 25. Forked arclight-api-1.5.4: route those two methods to jdk.internal.misc.Unsafe via the trusted IMPL_LOOKUP, force the StackWalker caller-class path, and neutralise the now-dead defineAnonymousClass branch. The patched jar is embedded in place of the Maven artifact. Verified: the server still boots on JDK 17 and now gets past ForgeInstaller + Forge launcher bootstrap on JDK 25. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
On Java 25 the Mixin (0.8.5) bytecode provider cannot resolve org.objectweb.asm.ClassVisitor metadata, so preprocessing JavaPluginLoaderMixin (whose merged methods referenced ClassVisitor/ClassWriter) crashed with ClassMetadataNotFoundException, aborting server start. Extract the ASM EventExecutor generation (createExecutor/createConstructor/ createImpl + the cache/counter) into a normal helper class EventExecutorGenerator that the mixin calls. The mixin no longer exposes any org.objectweb.asm.* type to Mixin's preprocessor; the ASM classes still load and run fine at runtime. With this + the Unsafe patch the server now reaches "Done! For help, type help" on Java 25 (verified on Corretto 25), and still on 17. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ForgeInstaller.addToPath built jdk.internal.loader.URLClassPath via its (URL[], AccessControlContext) constructor, which was removed on JDK 24+ when JEP 486 dropped the AccessControlContext parameter. On Java 25 this threw NoSuchMethodException on every addToPath call (spammed to stderr). Try the legacy (URL[], AccessControlContext) constructor first (JDK 17-21) and fall back to the new (URL[]) constructor (JDK 24+). Verified: no more spam and the server reaches "Done! For help, type help" on Corretto 25. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…light-api Regression from rebuilding arclight-api's decompiled Unsafe: the decompiler had dropped the (Object) cast on the last invokeExact argument of defineAnonymousClass, so the recompiled call passed `objects` as Object[] while the H_DEF_CLASS handle (ClassLoader.defineClass0) expects Object, throwing WrongMethodTypeException whenever a plugin registered event listeners (JavaPluginLoader.createRegisteredListeners -> EventExecutorGenerator). Restore the (Object) cast. Verified with a test plugin on Corretto 25: listener registration generates the EventExecutor and ServerLoadEvent is delivered to the plugin. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The Java 25 fixes for io.izzel.arclight.api.Unsafe ship as a rebuilt binary jar (arclight-forge/libs/arclight-api-1.5.4-j25.jar) because arclight-api's source isn't published. Keep the patched source under arclight-forge/patches/ so the change is reviewable and the jar reproducible. No build behaviour change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
But
Rendre le serveur Arclight (Forge 1.20.1 / 47.4.18) compatible Java 25 au runtime. Le build reste fait avec un JDK 17 ; seul l'exécution du serveur cible Java 25.
Constat clé
La stack launcher de Forge 47.4.18 (securejarhandler 2.1.10, modlauncher 10.0.9, bootstraplauncher, mixin 0.8.5) boote déjà sur Java 25. Il ne restait que des usages d'API JDK supprimées.
Correctifs
Unsafe(jar repatché + source vendorée sousarclight-forge/patches/) :ensureClassInitialized/shouldBeInitializedroutés versjdk.internal.misc.Unsafe(supprimés desun.misc.Unsafeen JDK 22+), caller-class viaStackWalker(le constructeurSecurityManagerjette en JDK 24+, JEP 486), et cast(Object)rétabli surdefineAnonymousClass.JavaPluginLoaderMixin: la génération ASM d'EventExecutorest extraite vers un helperEventExecutorGenerator. Mixin 0.8.5 ne sait pas résoudre les métadonnéesorg.objectweb.asm.ClassVisitorsur Java 25 quand elles sont dans des méthodes du mixin.ForgeInstaller.addToPath: fallback surURLClassPath(URL[])(le constructeur(URL[], AccessControlContext)a disparu en JDK 24+).Validation (Corretto 25.0.2)
Done! For help, type "help", arrêt propre. Pas de régression sur JDK 17.ServerLoadEvent.CraftServer+ NMS remappées correctement par le remapper (CraftServer.getServer()→net.minecraft.server.dedicated.DedicatedServer).🤖 Generated with Claude Code