Support class file versions through Java 25 (major 69) - #2
Merged
Conversation
The decoder guarded on `majorVersion > 63`, rejecting Java 20-25 class files even though all of their structures (attributes, constant pool tags, opcodes, stack map frames) already decode correctly. The format has been stable since Java 17 (major 61); no new structures were added in 20-25. Add a `ClassFormatVersion.Latest` constant (= Java25) and compare the decoder guards against it so the cap tracks the newest defined version automatically instead of drifting behind a magic number. Co-Authored-By: Claude Opus 4.8 <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.
@
Summary
The decoder guarded on
majorVersion > 63, rejecting Java 20–25 class files even though all of their structures already decode correctly. This raises the cap to Java 25 (major 69).Background
I audited the full class-file surface against the JVMS through Java 25:
Dynamic,InvokeDynamic,Module,Package)NestHost/NestMembers,Record,PermittedSubclasses); full decode↔encode round-tripjsr_w, 201)The class file format has been stable since Java 17 (major 61,
PermittedSubclasses). Java 20–25 bumped the version number for compatibility gating and preview-feature binding, not for new permanent structures. So no new structures needed implementing — only the stale guard was blocking these versions.Changes
ClassFormatVersion.Latest(=Java25).majorVersion > 63guards (inTryMeasureandTryRead) with a comparison againstClassFormatVersion.Latest.Major, so the cap tracks the newest defined version automatically instead of drifting behind a magic number.Notes
StackMapFrame.CopyToroutes frame types 64–65 toSameStackMapFrame(valid only 0–63). Not version-related; can be a follow-up.🤖 Generated with Claude Code
@