Don't check synchronized blocks within unannotated code#1185
Merged
Conversation
There was a problem hiding this comment.
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 ReportAll modified and coverable lines are covered by tests ✅
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. 🚀 New features to boost your workflow:
|
yuxincs
approved these changes
Apr 2, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1184
We forgot to add the standard check for unannotated code to
matchSynchronized