Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce scoped variable trait #4682

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Laurens-W
Copy link
Contributor

What's changed?

Added a trait to pull together the scope and identifier of NamedVariables and added testcases to showcase its usage

Anyone you would like to review specifically?

@sambsnyd @timtebeek

Any additional context

Continued from

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

import org.openrewrite.trait.Trait;

@Value
public class ScopedVariable implements Trait<J.VariableDeclarations.NamedVariable> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to support instanceof pattern matching, then we won't be able to use NamedVariable as the generic type parameter but would instead have to use J for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

2 participants