Repository navigation
feat!: expose Java declaration modifiers as named nodes - #24
Merged
Merged
Conversation
Represent declaration access keywords as visibility nodes and other modifier keywords as modifier nodes, preserving their keyword tokens and annotation children for queries and structural tooling. Co-authored-by: WillBooster (Codex CLI) <Codex CLI@willbooster.com>
Regenerate the structural modifier parser with the runtime released in Java grammar 4.0.0 and validate its queries and incremental edits. Co-authored-by: WillBooster (Codex CLI) <Codex CLI@willbooster.com>
Co-authored-by: WillBooster (Codex CLI) <Codex CLI@willbooster.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.
Why
Named declaration modifier nodes let structural tools represent visibility and modifier changes independently of annotations.
tree-sitter/tree-sitter-java#204andtree-sitter/tree-sitter-java#211request this structural access; Mergiraf's current Java language configuration uses separatevisibilityandmodifiernodes to merge modifier edits and distinguish them from annotations.Requirements
tree-sitter/tree-sitter-java#204.visibilityand other declaration modifier keywords asmodifier, matching the useful grouping in the upstream proposal and structural merge tooling without introducing a node type for each keyword.Customer Summary
Declaration modifiers now expose named
visibilityandmodifierchildren for structural tools and queries. Queries can select public static methods independently of annotations, including after incremental edits. Keyword tokens remain available for highlighting.Technical Summary
Add the two grammar rules under
modifiers, regenerate the parser and node metadata, and update corpus expectations for the additional nodes. The README includes a query example. The new public Wasm API regression selects an annotated public static method, changes its visibility incrementally, and checks that the query result changes while both methods remain intact. Annotation text deliberately contains access keywords to verify structural selection.Mergiraf's concrete consumer configuration is in its current Java language definition, which groups
visibility/modifierchildren separately from annotations and gives them independent signatures.Testing
bun run build-wasm: canonical generation and Wasm compilation passed from all 151 corpus inputs.bun run verify: passed with no code-gauge violations.cargo test --locked: native binding and executable documentation passed.Notes
The AST change adds named children beneath
modifiers. Consumers that assume its only named children are annotations must account for the additional nodes. The parser is regenerated with runtime 7.0.5 after integrating the released main branch. The Rust usage example selects major version 5 for the breaking AST release.