Skip to content

Conversation

@timtebeek
Copy link
Member

What's changed?

Added a new recipe with very limited scope in applying var only where initialized by a type cast within methods.

What's your motivation?

This seemed like a simple and safe, non-controversial usage of var that we can then adopt in our tests, which frequently unpack and cast.

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

Any edge cases where this might be unsafe?

Have you considered any alternatives or workarounds?

Could have also tackled static initializer blocks, but that seemed rare to me to have casts there.

@timtebeek timtebeek requested a review from MBoegers January 11, 2026 12:20
@timtebeek timtebeek self-assigned this Jan 11, 2026
@timtebeek timtebeek added the recipe Recipe requested label Jan 11, 2026
@github-project-automation github-project-automation bot moved this to In Progress in OpenRewrite Jan 11, 2026
@timtebeek timtebeek moved this from In Progress to Ready to Review in OpenRewrite Jan 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

recipe Recipe requested

Projects

Status: Ready to Review

Development

Successfully merging this pull request may close these issues.

2 participants