Skip to content

Prepare to changes to var in AST#1342

Merged
copybara-service[bot] merged 1 commit intomasterfrom
test_876115710
Feb 27, 2026
Merged

Prepare to changes to var in AST#1342
copybara-service[bot] merged 1 commit intomasterfrom
test_876115710

Conversation

@copybara-service
Copy link

Prepare to changes to var in AST

After https://bugs.openjdk.org/browse/JDK-8268850, VariableTree#getType returns a new AST node VarTypeTree for variables declared with var.

The new node could be handled in the visitor by implementing visitVarType, but that API is only available on the latest JDK versions using var, which would require creating a new version-specific visitor implementation. To defer doing that, this fix re-orders the logic that handles variable types to check if the next token is var first, to avoid needing to handle the new AST node.

After https://bugs.openjdk.org/browse/JDK-8268850, `VariableTree#getType` returns a new AST node `VarTypeTree` for variables declared with `var`.

The new node could be handled in the visitor by implementing `visitVarType`, but that API is only available on the latest JDK versions using var, which would require creating a new version-specific visitor implementation. To defer doing that, this fix re-orders the logic that handles variable types to check if the next token is `var` first, to avoid needing to handle the new AST node.

PiperOrigin-RevId: 876244813
@copybara-service copybara-service bot merged commit 075e025 into master Feb 27, 2026
@copybara-service copybara-service bot deleted the test_876115710 branch February 27, 2026 15:30
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