Skip to content

Parse Java 25: module imports, flexible constructor bodies, and two pattern forms - #233

Closed
arraypress wants to merge 1 commit into
tree-sitter:masterfrom
arraypress:java-25
Closed

arraypress wants to merge 1 commit into
tree-sitter:masterfrom
arraypress:java-25

Conversation

@arraypress

Copy link
Copy Markdown

Parses Java 25 syntax that currently produces ERROR nodes.

Added

Tests: all existing corpus tests pass unchanged. New test/corpus/java25.txt covers each construct.

Generated with tree-sitter-cli 0.24.7, which regenerates the current src/parser.c byte for byte, so the ABI stays at 14.

If you'd rather merge #230 and #231 on their own, I'll drop those two parts.

🤖 Generated with Claude Code

…attern forms

- `import module java.base;` (JEP 511)
- Statements before `this(…)` / `super(…)` in a constructor (JEP 513)
- A qualified type in a record pattern: `o instanceof Shapes.Point(var x, var y)` (as in tree-sitter#231)
- `final` on a type pattern: `case final String s ->` (as in tree-sitter#230)

New corpus: test/corpus/java25.txt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wetneb

wetneb commented Oct 2, 2026 •

Copy link
Copy Markdown

Hi @arraypress,
Since external pull requests are rarely integrated in this repository, we have formed a small group of contributors and users to maintain a fork of this grammar. I looked into integrating your change to our fork, but it turns out that all those constructs are solved there already.

If you encounter any issue switching to our fork as a user or contributor, I would be happy to hear what we could improve to enable that.

@arraypress

Copy link
Copy Markdown
Author

Thank you @wetneb, that's very helpful. I checked the fork: it parses our whole Java 25 test file without errors and our highlight queries work on it unchanged, so we've switched our vendored Java grammar to tree-sitter-java-orchard and dropped this patch. Closing this in its favour.

@arraypress arraypress closed this Oct 2, 2026
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.

2 participants