Add Java 26 early-access support via rewrite-java-next module#6789
Closed
Add Java 26 early-access support via rewrite-java-next module#6789
Conversation
Adds a new rewrite-java-next module (copy of rewrite-java-25) to support Java 26 pre-release builds, enabling early validation of the OpenRewrite parser against upcoming JDK versions. Updates version detection cascade in JavaParser and CI workflows to include Java 26.
timtebeek
commented
Feb 22, 2026
timtebeek
commented
Feb 22, 2026
Adds --enable-preview to the ReloadableJavaNextParser compiler options so the parser can handle preview language features like JEP 530 (Primitive Types in Patterns, instanceof, and switch). Adds tests for primitive type patterns in switch expressions and instanceof with guards, narrowing conversions, and different primitive types (int, long, float).
Member
Author
|
It looks like we should be good to support the non-preview features in Java 26 already, and even the We'll defer this effort until later, such that we don't have to unnecessarily maintain yet another Java parser with any changes. |
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
Adds a new
rewrite-java-nextmodule to support Java 26 early-access builds. This enables early validation of the OpenRewrite parser against pre-release JDK versions. The module is structured as a copy ofrewrite-java-25with version references updated to 26.Changes
rewrite-java-nextmodule with Java 26 toolchain and parser implementationJavaParserversion detection cascade to preferJavaNextParserfor JDK 26+Java25toJavaNext(e.g.,JavaNextParser,ReloadableJavaNextParser)