From 05c8a47a0621d2cebd3444e4fdebca4715ad2582 Mon Sep 17 00:00:00 2001 From: pih <115072567+ailiujiarui@users.noreply.github.com> Date: Wed, 19 Aug 2026 15:27:37 +0800 Subject: [PATCH 1/2] fix: avoid Java 25 for legacy Fabric --- .../Modules/Minecraft/ModJava.vb | 5 ++ ...issue-9239-java-25-fabric-compatibility.md | 48 +++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 docs/design/issue-9239-java-25-fabric-compatibility.md diff --git a/Plain Craft Launcher 2/Modules/Minecraft/ModJava.vb b/Plain Craft Launcher 2/Modules/Minecraft/ModJava.vb index 67cfdda..7ce900d 100644 --- a/Plain Craft Launcher 2/Modules/Minecraft/ModJava.vb +++ b/Plain Craft Launcher 2/Modules/Minecraft/ModJava.vb @@ -251,6 +251,11 @@ Public Module ModJava '1.18+:Java 17+ AddConstraint(ValueRange(Of Version).AtLeast(New Version(17, 0))) End If + If Instance.Version.Fabric <> "未知版本" AndAlso + CompareVersion(Instance.Version.Fabric, "0.17.0") < 0 Then + 'Fabric Loader 0.16.x 及更早版本的 Mixin/ASM 不兼容 Java 25 + AddConstraint(ValueRange(Of Version).LessThan(New Version(25, 0))) + End If End If 'LiteLoader 检测 diff --git a/docs/design/issue-9239-java-25-fabric-compatibility.md b/docs/design/issue-9239-java-25-fabric-compatibility.md new file mode 100644 index 0000000..3ad32ec --- /dev/null +++ b/docs/design/issue-9239-java-25-fabric-compatibility.md @@ -0,0 +1,48 @@ +# Issue 9239: Java 25 and legacy Fabric compatibility + +## Context + +Issue #9239 reports that automatic Java selection fails for a Minecraft 1.21.4 +instance, while manually selecting Java 21 succeeds. The supplied PCL log shows +that PCL selects Java 25 from the official runtime directory because it is first +in the configured Java list and satisfies the current `[21.0, +infinity)` +requirement. + +Although the issue description says no mods are installed, the supplied launch +script and crash log show Fabric Loader `0.16.12`. The crash is caused by its +Mixin/ASM stack attempting to read a Java 25 class (class-file major version +69), which it does not support. + +## Current implementation + +- `GetJavaRequirement` in `Plain Craft Launcher 2/Modules/Minecraft/ModJava.vb` + assigns Minecraft 1.20.5+ a lower Java bound of 21. +- Fabric instances only add lower bounds today, so Fabric 0.16.12 retains an + unbounded upper range. +- Automatic selection walks the user-configured Java list and selects the first + checked Java in that range. The list sorter prioritizes official runtime + locations, making Java 25 selected before installed Java 21 entries. + +## Design + +For Fabric Loader versions older than `0.17.0`, add an exclusive Java 25 upper +bound (`< 25.0`) during requirement analysis. This makes Java 21--24 eligible +for Minecraft 1.21.4 while preventing the known incompatible Java 25 runtime +from being selected. Fabric Loader 0.17.0 and later retains the existing open +upper bound so compatible newer loaders may use Java 25. + +The boundary is based on the loader-published dependencies: Fabric Loader +0.16.12 uses ASM 9.7.1, while 0.17.0 upgrades to ASM 9.8 with Java 25 +class-file support. + +The constraint is applied only in automatic selection. Explicit Java choices +and user-defined Java ranges remain authoritative, preserving the existing +escape hatches for advanced users. + +## Verification + +- Confirm the 1.21.4/Fabric 0.16.12 requirement becomes `[21.0, 25.0)`. +- Confirm Java 25 is skipped and Java 21 is selected when both are configured. +- Confirm a Fabric Loader version at or above 0.17.0 retains its existing + Java-version range. +- Build the solution and review the final diff for scope and regressions. From 140348e10d03e7db61bd41af5ed575bef94751fa Mon Sep 17 00:00:00 2001 From: pih Date: Wed, 19 Aug 2026 19:56:42 +0800 Subject: [PATCH 2/2] chore: remove issue design note --- ...issue-9239-java-25-fabric-compatibility.md | 48 ------------------- 1 file changed, 48 deletions(-) delete mode 100644 docs/design/issue-9239-java-25-fabric-compatibility.md diff --git a/docs/design/issue-9239-java-25-fabric-compatibility.md b/docs/design/issue-9239-java-25-fabric-compatibility.md deleted file mode 100644 index 3ad32ec..0000000 --- a/docs/design/issue-9239-java-25-fabric-compatibility.md +++ /dev/null @@ -1,48 +0,0 @@ -# Issue 9239: Java 25 and legacy Fabric compatibility - -## Context - -Issue #9239 reports that automatic Java selection fails for a Minecraft 1.21.4 -instance, while manually selecting Java 21 succeeds. The supplied PCL log shows -that PCL selects Java 25 from the official runtime directory because it is first -in the configured Java list and satisfies the current `[21.0, +infinity)` -requirement. - -Although the issue description says no mods are installed, the supplied launch -script and crash log show Fabric Loader `0.16.12`. The crash is caused by its -Mixin/ASM stack attempting to read a Java 25 class (class-file major version -69), which it does not support. - -## Current implementation - -- `GetJavaRequirement` in `Plain Craft Launcher 2/Modules/Minecraft/ModJava.vb` - assigns Minecraft 1.20.5+ a lower Java bound of 21. -- Fabric instances only add lower bounds today, so Fabric 0.16.12 retains an - unbounded upper range. -- Automatic selection walks the user-configured Java list and selects the first - checked Java in that range. The list sorter prioritizes official runtime - locations, making Java 25 selected before installed Java 21 entries. - -## Design - -For Fabric Loader versions older than `0.17.0`, add an exclusive Java 25 upper -bound (`< 25.0`) during requirement analysis. This makes Java 21--24 eligible -for Minecraft 1.21.4 while preventing the known incompatible Java 25 runtime -from being selected. Fabric Loader 0.17.0 and later retains the existing open -upper bound so compatible newer loaders may use Java 25. - -The boundary is based on the loader-published dependencies: Fabric Loader -0.16.12 uses ASM 9.7.1, while 0.17.0 upgrades to ASM 9.8 with Java 25 -class-file support. - -The constraint is applied only in automatic selection. Explicit Java choices -and user-defined Java ranges remain authoritative, preserving the existing -escape hatches for advanced users. - -## Verification - -- Confirm the 1.21.4/Fabric 0.16.12 requirement becomes `[21.0, 25.0)`. -- Confirm Java 25 is skipped and Java 21 is selected when both are configured. -- Confirm a Fabric Loader version at or above 0.17.0 retains its existing - Java-version range. -- Build the solution and review the final diff for scope and regressions.