Repository navigation
fix(android): Resolve NullAway findings in sentry-android-core - #6497
Draft
runningcode wants to merge 1 commit into
Draft
runningcode wants to merge 1 commit into
runningcode wants to merge 1 commit into
Conversation
NullAway never ran on sentry-android-core. Enabling it reports 32 errors. Most are fields and return types that are nullable but not annotated, and fields NullAway cannot see as checked because a check happens in a different scope (a lambda, another method) than the dereference. - Annotate the nullable fields and return types, including ViewHierarchyNode.setType and UiElement.equals in the sentry module. - Read options once in lambdas, and pass scopes and options to createStandaloneAppStartTransaction, whose callers already check them. - Compute the device family once instead of through a LazyEvaluator, whose evaluator must not return null. - Create the system events HandlerThread in the branch that uses it, inside the existing try. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 of 9 tasks
📲 Install BuildsAndroid
|
This branch has not been deployed
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.
📜 Description
Fixes the 32 NullAway errors in
sentry-android-core. Most are nullable fields and return types without@Nullable, or null checks NullAway can't connect to the dereference because they happen in another scope (a lambda, a caller).sentrymodule, this covers the parameters ofViewHierarchyNode.setTypeandUiElement.equals.optionsonce in lambdas, and passesscopesandoptionstocreateStandaloneAppStartTransaction, whose callers already check them.DefaultAndroidEventProcessorinstead of through aLazyEvaluator, whose evaluator must not return null.ContextUtils.getFamilyonly splitsBuild.MODEL.HandlerThreadin the branch that uses it, inside the existingtry.💡 Motivation and Context
NullAway is set to ERROR for
sentry-android-corebut never ran, because Error Prone didn't run there at all (#6493). This is one of four independent PRs that fix what it reports.💚 How did you test it?
Compiled with Error Prone enabled: no NullAway findings remain and none are added. The unit tests of the touched classes pass.
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
ViewHierarchyEventProcessor.snapshotViewHierarchyAsDatais now@Nullable. It already returned null when the hierarchy couldn't be captured. Kotlin callers in hybrid SDKs now seeByteArray?and have to handle null.🤖 Generated with Claude Code
#skip-changelog