Repository navigation
build(android): Run Error Prone and NullAway on the Android modules - #6493
Merged
Merged
Conversation
This was referenced Nov 6, 2026
runningcode
added a commit
that referenced
this pull request
Nov 10, 2026
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>
runningcode
added a commit
that referenced
this pull request
Nov 10, 2026
#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>
runningcode
marked this pull request as ready for review
November 10, 2026 13:38
runningcode
requested review from
0xadam-brown and
markushi
and removed request for
a team
November 10, 2026 13:39
runningcode
force-pushed
the
no/errorprone-android-modules
branch
from
November 10, 2026 13:43
7606835 to
73b8303
Compare
runningcode
added a commit
that referenced
this pull request
Nov 11, 2026
* ref(android): Fix Error Prone warnings in sentry-android-core 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> * ref(android): Fix the Error Prone warnings only main has - 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> * ref(android): Keep the default charset reads as they were 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> * ref(android): Drop the UnnecessaryLambda suppressions #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> * ref(android): Drop the updater field comment Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(android): Make the local-class method comment a plain comment 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> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
runningcode
force-pushed
the
no/errorprone-android-modules
branch
from
November 11, 2026 11:35
73b8303 to
0509797
Compare
romtsn
approved these changes
Nov 11, 2026
net.ltgt.errorprone dropped Android support in 3.0.0, which we have used since 6.7. Since then it only enables Error Prone and adds it to the processor path for Gradle's JVM source sets. On sentry-android-core and sentry-uitest-android the errorprone dependencies and the NullAway ERROR setting had no effect, and the Java compile tasks ran plain javac. Use the AGP variant API to add the errorprone configuration to each variant's annotation processor configuration and enable Error Prone on its JavaCompile task. Both APIs exist in AGP 9.0.0, the oldest version in the AGP matrix. Pass -XDandroidCompatible=true so Error Prone treats these modules as Android code: it skips checks that don't apply there, such as DefaultCharset, and runs its Android checks. sentry-uitest-android has no hand-written Java, so exclude the view binding classes AGP generates, which trip LabelledBreakTarget. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
runningcode
force-pushed
the
no/errorprone-android-modules
branch
from
November 11, 2026 14:29
0509797 to
e80ff51
Compare
…vider NullAway treats AtomicReference.get() as nullable, so the snapshot reads added in #6537 fail once NullAway runs on sentry-android-core. The snapshot is never set to null, so read it through one accessor that suppresses the finding. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
📲 Install BuildsAndroid
|
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
Error Prone, and with it NullAway and Nopen, never ran on the Android modules.
💡 Motivation and Context
Error prone and nullaway help catch bugs!
💚 How did you test it?
CI passes
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
sentry-android-ndk,sentry-android-replayandsentry-launchdarkly-androidhave Java sources but don't apply Error Prone at all.Issues
🤖 Generated with Claude Code
#skip-changelog