Skip to content

Fix AssertThrowsOnLastStatement crash on TypeCast arguments#933

Merged
timtebeek merged 1 commit intomainfrom
tim/fix-junit5-mockito-dep
Mar 20, 2026
Merged

Fix AssertThrowsOnLastStatement crash on TypeCast arguments#933
timtebeek merged 1 commit intomainfrom
tim/fix-junit5-mockito-dep

Conversation

@timtebeek
Copy link
Copy Markdown
Member

@timtebeek timtebeek commented Mar 20, 2026

Summary

Add `J.TypeCast` to the early-return filter in `extractExpressionArguments`
so cast expressions like `(Object[]) null` are left in place rather than
being extracted into variable declarations, which fails for array cast types.

Fixes openrewrite/rewrite#7082
@github-project-automation github-project-automation bot moved this to In Progress in OpenRewrite Mar 20, 2026
@timtebeek timtebeek merged commit cad9d19 into main Mar 20, 2026
1 check passed
@timtebeek timtebeek deleted the tim/fix-junit5-mockito-dep branch March 20, 2026 19:33
@github-project-automation github-project-automation bot moved this from In Progress to Done in OpenRewrite Mar 20, 2026
@sudiptasish
Copy link
Copy Markdown

What is the new version @timtebeek ?

@timtebeek
Copy link
Copy Markdown
Member Author

There is a new
snapshot version already: v3.31.0-SNAPSHOT. the regular release well follow somewhere the coming week must likely: https://github.com/openrewrite/rewrite-testing-frameworks/releases

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.

IllegalArgumentException: Expected a template that would generate exactly one statement to replace one statement, but generated 0

2 participants