Repository navigation
ref(android): Fix Error Prone warnings in sentry-android-core - #6499
Merged
Merged
Conversation
4 of 9 tasks
Contributor
🚨 Detected changes in high risk code 🚨High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:
|
📲 Install BuildsAndroid
|
Error Prone never ran on sentry-android-core. Enabling it reports 59 warnings outside Javadoc, which fail the build under -Werror. - Suppress FutureReturnValueIgnored, JavaUtilDate, and ReferenceEquality where identity is intended, as the sentry module does. - Keep the AnrProfilingIntegration updater a field, since removeCallbacks needs the instance that was posted, and suppress UnnecessaryLambda there. - Read the ANR thread dump and the app start profiling config as UTF-8, Android's default charset. - Remove unused fields and parameters, add missing @OverRide, make long-to-double conversions explicit, and narrow members that are effectively private or protected in a final class. - Explain the two catch blocks that ignore their exception. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- ANRWatchDog.monotonicTicker is never read (#6041), since the ticker lambda captures the constructor parameter. Remove the field and keep the parameter. - ActivityFramesTracker.lock is protected in a final class; make it package-private. - LifecycleWatcher reads the session start Date to seed the session window; suppress JavaUtilDate there, as the other Date uses are. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
runningcode
force-pushed
the
no/android-core-errorprone-warnings
branch
from
November 10, 2026 09:58
27e4672 to
c794404
Compare
Android's default charset is always UTF-8, so DefaultCharset is disabled for the Android modules in #6493 instead of being fixed here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#6493 disables UnnecessaryLambda for the Android modules, so the suppressions on the ANRWatchDog and AnrProfilingIntegration fields are redundant. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
runningcode
marked this pull request as ready for review
November 10, 2026 13:39
runningcode
requested review from
0xadam-brown and
romtsn
and removed request for
a team
November 10, 2026 13:39
…prone-warnings # Conflicts: # sentry-android-core/src/main/java/io/sentry/android/core/internal/util/AndroidConnectionStatusProvider.java
Error Prone's NotJavadoc flags Javadoc on methods of local classes, which #6537 added in AndroidConnectionStatusProvider. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 other 57 warnings Error Prone reports in
sentry-android-core:FutureReturnValueIgnored(18),JavaUtilDate(4) andReferenceEquality(12) at method level, as thesentrymodule does. Every reference comparison is meant to be by identity: activities, dialogs, windows and transactions.UnnecessaryLambdasuppressions. build(android): Run Error Prone and NullAway on the Android modules #6493 compiles the Android modules with-XDandroidCompatible=true, which makes Error Prone skipUnnecessaryLambdaandDefaultCharsetthere, as Android's default charset is always UTF-8.@Override, makes long-to-double conversions explicit, and narrows members that are effectively private or protected in a final class.💡 Motivation and Context
Error Prone never ran on
sentry-android-core(#6493). Under-Werrorthese warnings fail the build once it does. This is one of four independent PRs that fix what it reports. It targetsmainbecause it breaks no public API (the.apidumps are unchanged); it reaches9.x.xwith the next merge frommain.💚 How did you test it?
Compiled with Error Prone enabled: none of these warnings remain and none are added. The unit tests of the touched classes pass.
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
Issues
🤖 Generated with Claude Code
#skip-changelog