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

SONARJAVA-5421 Fix NPE in S2225 on return in void lambdas #5065

Merged
merged 2 commits into from
Mar 25, 2025

Conversation

romainbrenguier
Copy link
Contributor

@romainbrenguier romainbrenguier commented Mar 24, 2025

SONARJAVA-5421

With this changes, we check whether we are inside a lambda in the interesting method before looking at return statement.
This has the effect of avoiding some null pointer exceptions.

…sh with NPE

Case of a lambda returning void in a toString method.
To avoid false positives in lambdas declared inside toString methods.
@romainbrenguier romainbrenguier marked this pull request as ready for review March 24, 2025 14:56
@romainbrenguier romainbrenguier requested a review from a team March 24, 2025 14:58
@dorian-burihabwa-sonarsource dorian-burihabwa-sonarsource changed the title SONARJAVA-5421 Fix NPE in ToStringReturningNullCheck SONARJAVA-5421 Fix NPE in S2225 on return in void lambdas Mar 25, 2025
@romainbrenguier romainbrenguier merged commit d36cd19 into master Mar 25, 2025
18 checks passed
@romainbrenguier romainbrenguier deleted the romain/fix-toStringCheck-NPE branch March 25, 2025 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants