Skip to content

fix(build): target Java 21 bytecode so 1.21 servers can load the plugin - #176

Merged
imDMK merged 1 commit into
mainfrom
fix/target-java-21
Aug 26, 2026
Merged

fix(build): target Java 21 bytecode so 1.21 servers can load the plugin#176
imDMK merged 1 commit into
mainfrom
fix/target-java-21

Conversation

@imDMK

@imDMK imDMK commented Aug 26, 2026

Copy link
Copy Markdown
Owner

#175 raised both the toolchain and the release to 25, which emits class file 69 and makes the plugin unloadable on any JVM below 25. Minecraft 1.21 requires Java 21, so stock servers at the low end of the supported range would fail with UnsupportedClassVersionError despite the API compatibility work in that PR.

Nothing in the dependency chain justified the higher target: the Spigot API is class file 61 in both 1.21 and 26.2, and the highest bundled library is also 61. The sources use no language feature past 21 either.

Keep building on JDK 25 and lower the emitted bytecode to 21 by splitting the single JAVA constant into JAVA_TOOLCHAIN and JAVA_RELEASE. The shipped jar now tops out at class file 65 and loads on Java 21 and newer.

Description

Provide a brief description of what changes have been made.

If the error has been fixed, put:

Fixes: #(number of issue)

Have the changes been tested?

  • Yes
  • No

#175 raised both the toolchain and the release to 25, which emits class file
69 and makes the plugin unloadable on any JVM below 25. Minecraft 1.21
requires Java 21, so stock servers at the low end of the supported range
would fail with UnsupportedClassVersionError despite the API compatibility
work in that PR.

Nothing in the dependency chain justified the higher target: the Spigot API
is class file 61 in both 1.21 and 26.2, and the highest bundled library is
also 61. The sources use no language feature past 21 either.

Keep building on JDK 25 and lower the emitted bytecode to 21 by splitting
the single JAVA constant into JAVA_TOOLCHAIN and JAVA_RELEASE. The shipped
jar now tops out at class file 65 and loads on Java 21 and newer.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@imDMK
imDMK merged commit ecdd0da into main Aug 26, 2026
1 check passed
@imDMK
imDMK deleted the fix/target-java-21 branch August 26, 2026 08:43
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

Successfully merging this pull request may close these issues.

1 participant