Fix Kotlin 2.4-surfaced compiler warnings
Categories
(Firefox for Android :: Tooling, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox152 | --- | fixed |
People
(Reporter: RyanVM, Assigned: RyanVM)
References
Details
Attachments
(4 files)
Fixes UNUSED_EXPRESSION, NO_ELSE_IN_WHEN, UNUSED_LAMBDA_EXPRESSION, and InflateParams warnings that Kotlin 2.4 surfaces. Covers BrowserPrefObserverIntegration (latent real bug where lambdas referenced params without invoking them), ShareTargetParser, TabGroupCard, and dialog inflate suppressions.
| Assignee | ||
Comment 1•2 months ago
|
||
Diagnostic: NO_ELSE_IN_WHEN.
| Assignee | ||
Comment 2•2 months ago
|
||
Diagnostic: UNUSED_LAMBDA_EXPRESSION.
| Assignee | ||
Comment 3•2 months ago
|
||
Removes spurious Unit literals left over from K2.4's UNUSED_EXPRESSION
diagnostic. Most sites are cosmetic (bare Unit at the end of a when arm,
Unit inside a lambda body that was never needed).
One site is a real latent bug: BrowserPrefObserverIntegration was
wrapping each callback in a lambda that referenced but never invoked it:
onSuccess = { onSuccess } // ← outer lambda discards the callback
onError = { onError }
The fix passes the callbacks through directly.
Diagnostic: UNUSED_EXPRESSION.
| Assignee | ||
Comment 4•2 months ago
|
||
The dialogs have no parent at inflation time; MaterialAlertDialogBuilder.setView()
attaches them later, so passing null as the root view is the correct call here.
Android Lint check: InflateParams.
Comment 6•2 months ago
|
||
The Bugbug bot thinks this bug should belong to the 'Firefox for Android::Tooling' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 7•2 months ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/eb515e8b374b
https://hg.mozilla.org/mozilla-central/rev/a2e671c2426c
https://hg.mozilla.org/mozilla-central/rev/1bc9f69bb7bb
https://hg.mozilla.org/mozilla-central/rev/d2785540a5af
Description
•