Repository navigation
Run MCPC+ / Cauldron 1.6.4 servers on Java 17 - #1
Closed
MisterSandFR wants to merge 5 commits into
Closed
MisterSandFR wants to merge 5 commits into
MisterSandFR wants to merge 5 commits into
Conversation
- Spoof java.version on any non-Java 7 runtime to pass the MCPC+ check. - Patch launchwrapper's Launch constructor: the app class loader is no longer a URLClassLoader, so build LaunchClassLoader from java.class.path and delegate platform-loader packages (javax.sql, javax.script...). - Open every JDK package to unnamed modules and remove the Java 12+ reflection filters (Field.modifiers), as on Java 8. - Redirect sun.reflect.ReflectionFactory / ConstructorAccessor / FieldAccessor to shims so Forge's EnumHelper can still add enum values. - Rename the agent to mcpc-java17-agent and require Java 17 to build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DszbR9jSTnJF2dtbGNiQRv
The NGServer build of MCPC+ 1.6.4 ships a Launch that no longer casts the app class loader, and is compiled against ASM 9: replacing those classes with the stock launchwrapper 1.8 / ASM 4 ones broke it. - Replace Launch only if it still references URLClassLoader. - Replace the ASM classes only if the loader's ClassReader predates ASM 5. - Configure LaunchClassLoader (platform packages, agent shims) from the transformer when it defines its first class, so it no longer depends on the patched Launch. Tested: NGServer MCPC+ 1.6.4 boots to Done and stops cleanly on JDK 17. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DszbR9jSTnJF2dtbGNiQRv
ASM 4.1 cannot read Java 8+ bytecode nor run coremods written against a recent ASM API, so mods built for Java 8 could not load. The agent now ships ASM 9.7 and serves its classes in place of ASM 4 ones when the server uses ASM 4 (servers already on ASM 5+ keep theirs). The ASM 4 class patches are superseded and removed. The bundled ASM is adapted at build time so Forge 1.6.4 and ASM 4 era code keep working: - Remapping*Adapter classes, removed after ASM 7.0, come from ASM 7.0. - Type.getType(String) accepts internal names, as ASM 4 did (Forge's EventTransformer). - Visitors declared with the ASM 4 API no longer throw 'requires ASMx' on newer bytecode (FML's mod parser), and the interface flag of method calls survives them (LegacyAsmApi). LaunchClassLoader delegates org.objectweb.asm to the application class loader so a single ASM is used. Tested on JDK 17 with a Java 8 mod + ASM9 coremod: stock MCPC+ 1.6.4 and the NGServer build (with ASM 4 or ASM 9 in libraries) boot to Done with the mod active and no FML errors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DszbR9jSTnJF2dtbGNiQRv
Builds the jar on every push and pull request (downloadable as a workflow artifact), and attaches it to a GitHub release when a v* tag is pushed. Make gradlew executable so the wrapper runs in CI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DszbR9jSTnJF2dtbGNiQRv
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DszbR9jSTnJF2dtbGNiQRv
🤖 Augment PR SummarySummary: Migrates the MCPC+/Cauldron startup agent from Java 8 support to Java 17 support.
🤖 Was this summary useful? React with 👍 or 👎 |
| private boolean needsPatch(ClassLoader loader, String className, byte[] original) { | ||
| if (className.equals(LAUNCH)) { | ||
| // The stock constructor casts the application class loader to URLClassLoader. | ||
| return indexOf(original, "java/net/URLClassLoader".getBytes(StandardCharsets.US_ASCII)) >= 0; |
There was a problem hiding this comment.
This does not identify the cast described in the comment; it matches any URLClassLoader constant. A Java-9-ready Launch that still uses URLClassLoader elsewhere will be replaced wholesale by the bundled 1.8 class, discarding its server-specific behavior instead of being kept.
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
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.
L'agent démarre désormais les serveurs MCPC+ / Cauldron 1.6.4 sous Java 17 au lieu de Java 8. Il est renommé
mcpc-java17-agent(packagegg.nationsglory.mcpcj17, logs[mcpc-j17]).Ce que l'agent corrige sous Java 17
Check de version :
java.versionest présentée comme1.7.0_80sur toute JVM autre que Java 7.launchwrapper :
Launchcastait le class loader de l'application enURLClassLoader, ce qui échoue depuis Java 9. Il est remplacé seulement s'il fait encore ce cast.LaunchClassLoaderdélègue au JDK les packages du platform loader (javax.sql,javax.script…).Modules : tous les packages du JDK sont ouverts au serveur, et les filtres de réflexion de Java 12+ (
Field.modifiers) sont retirés.sun.reflect.ReflectionFactorysupprimé : les références (EnumHelper de Forge, NGEnumFactory…) sont redirigées vers des remplaçants fournis par l'agent.ASM : l'agent embarque ASM 9.7 et le substitue à l'ASM 4.1 de MCPC+, ce qui permet de charger des mods Java 8+ et des coremods utilisant une API ASM récente. Cet ASM est adapté au build pour rester compatible avec Forge 1.6.4 :
Remapping*Adapterrepris d'ASM 7.0 ;Type.getTypeaccepte un nom interne, comme ASM 4 ;requires ASMx, et le flag « interface » des appels est conservé.Un serveur qui a déjà un ASM ≥ 5 garde le sien.
CI : GitHub Actions construit le jar à chaque push ; un tag
v*publie une release avec le jar.Tests (OpenJDK 17.0.20)
Avec un mod de test compilé en Java 8 (lambdas, streams, méthodes static/default d'interface) qui contient aussi un coremod en
Opcodes.ASM9:Done, mod actif, 0 erreur FML. Sans agent :ClassCastExceptiondansLaunch.libraries/) :Done, mod actif, 0 erreur. Sans agent : plantage au chargement du monde.Les deux serveurs ont été testés sans joueurs connectés et sans les mods de production.
🤖 Generated with Claude Code
https://claude.ai/code/session_01DszbR9jSTnJF2dtbGNiQRv
Generated by Claude Code