Skip to content

Leave a Stack as it is when rewrite-analysis cannot follow where it flows, as its last release cannot through an anonymous class - #1151

Merged
jkschneider merged 1 commit into
mainfrom
stack-deque-without-flow
Oct 27, 2026
Merged

jkschneider merged 1 commit into
mainfrom
stack-deque-without-flow

Conversation

@jkschneider

Copy link
Copy Markdown
Member

In CGP's release train, rewrite-static-analysis 2.46.0's release build failed ReplaceStackWithDequeTest.doNotFailOnAnonymousClassWithMultipleReturningMethods twice. The cause was inside rewrite-analysis, at ForwardFlow$Analysis.visitNewClass (ForwardFlow.java:381).

A build of main resolves rewrite-analysis's 2.40.0-SNAPSHOT, which has the fix (rewrite-analysis cb0fbd69b4, "Print and visit trees under their parent cursor"). A release resolves its last release, 2.39.0, which doesn't. openrewrite/rewrite-analysis was archived on 2026-10-17 without releasing that fix. So a release of this recipe would have thrown on that code for anyone using it, which is what the regression test says it must not do.

When rewrite-analysis can't follow where the Stack flows, the recipe now leaves it as it is: the same outcome the test expects once the analysis works ("dataflow correctly detects that result is returned, so the Stack is not rewritten"). With rewrite-analysis forced to 2.39.0, the test fails on main and passes with this change.

The longer-term choice is still open: release rewrite-analysis's last commits as 2.40.0, or move off the archived module.

… flows, as its last release cannot through an anonymous class
@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite Oct 27, 2026
@jkschneider
jkschneider merged commit 95d46d5 into main Oct 27, 2026
1 check passed
@jkschneider
jkschneider deleted the stack-deque-without-flow branch October 27, 2026 00:44
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRewrite Oct 27, 2026
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.

1 participant