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

fix: FlowPath Analysis with chained lambda expressions #73

Merged
merged 1 commit into from
Dec 7, 2024

Conversation

amishra-u
Copy link
Contributor

@amishra-u amishra-u commented Dec 7, 2024

What's changed?

Flow path analysis currently fails for chained lambda expressions. The issue occurs because the lambda end is marked as ControlFlowNode.End, resulting in subsequent lambdas in the chain being skipped.

To resolve this, the lambda body is now marked as the start node when identifying flow paths for expressions within it. This approach eliminates the need to search for flow paths outside the lambda body, as per JLS §15.27.2, can be inferred that expressions within a lambda body cannot assign values to variables declared outside of the lambda body.

What's your motivation?

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

@timtebeek timtebeek added the bug Something isn't working label Dec 7, 2024
@timtebeek timtebeek merged commit 190153b into openrewrite:main Dec 7, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

FlowPath analysis doesn't work with Chained Lambda expressions.
2 participants