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

Correctly set Cursor in Repeat #4015

Merged

Conversation

JLLeitschuh
Copy link
Collaborator

The Cursor wasn't being set in Repeat causing issues when
used for non SourceFile trees.

Signed-off-by: Jonathan Leitschuh [email protected]

What's changed?

Adds a call to setCursor in the loop for Repeat.
Also adds internal validation that Repeat is being called with the correct
Cursor set.

What's your motivation?

When using Recipe visitors on sub-trees, and those visitors called autoFormat they were failing
when the JavaSourceFile couldn't be located in the Cursor hierarchy.

Anything in particular you'd like reviewers to focus on?

Anyone you would like to review specifically?

Have you considered any alternatives or workarounds?

Any additional context

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

@JLLeitschuh JLLeitschuh force-pushed the fix/JLL/repeat-cursor-correction branch from 857de0b to 811d20f Compare February 17, 2024 02:30
@JLLeitschuh
Copy link
Collaborator Author

@sambsnyd I think this is one for you to take a look at ideally.

The `Cursor` wasn't being set in `Repeat` causing issues when
used for non `SourceFile` trees.

Signed-off-by: Jonathan Leitschuh <[email protected]>
@JLLeitschuh JLLeitschuh force-pushed the fix/JLL/repeat-cursor-correction branch from 811d20f to 7535001 Compare February 17, 2024 02:39
@sambsnyd sambsnyd merged commit dd77edd into openrewrite:main Feb 17, 2024
1 check passed
@JLLeitschuh JLLeitschuh deleted the fix/JLL/repeat-cursor-correction branch February 17, 2024 03:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants