Skip to content

Don't check synchronized blocks within unannotated code#1185

Merged
msridhar merged 1 commit intomasterfrom
issue-1184
Apr 2, 2025
Merged

Don't check synchronized blocks within unannotated code#1185
msridhar merged 1 commit intomasterfrom
issue-1184

Conversation

@msridhar
Copy link
Copy Markdown
Collaborator

@msridhar msridhar commented Apr 2, 2025

Fixes #1184

We forgot to add the standard check for unannotated code to matchSynchronized

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes issue #1184 by ensuring that synchronized blocks in unannotated code are not checked during analysis.

  • Added an early return in matchSynchronized to ignore unannotated code.
  • Introduced a new test case (synchronizedInUnannotatedLambda) to validate the behavior in lambda expressions.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
nullaway/src/test/java/com/uber/nullaway/CoreTests.java Adds a new test case to verify that synchronized blocks in unannotated lambdas are not checked.
nullaway/src/main/java/com/uber/nullaway/NullAway.java Updates the matchSynchronized method to bypass unannotated code.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.21%. Comparing base (03dc42d) to head (98c3acc).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #1185   +/-   ##
=========================================
  Coverage     88.21%   88.21%           
- Complexity     2313     2314    +1     
=========================================
  Files            88       88           
  Lines          7551     7553    +2     
  Branches       1511     1511           
=========================================
+ Hits           6661     6663    +2     
  Misses          446      446           
  Partials        444      444           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@msridhar msridhar merged commit 059b90b into master Apr 2, 2025
12 checks passed
@msridhar msridhar deleted the issue-1184 branch April 2, 2025 20: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.

NullPointerException: no environment stored for lambda (from synchronized)

3 participants