Closed Bug 2036969 Opened 2 months ago Closed 2 months ago

Fix Kotlin 2.4-surfaced compiler warnings

Categories

(Firefox for Android :: Tooling, defect)

All
Android
defect

Tracking

()

RESOLVED FIXED
152 Branch
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.

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.

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.

Pushed by rvandermeulen@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/591dffabb1d8 https://hg.mozilla.org/integration/autoland/rev/eb515e8b374b Add explicit null branch to satisfy when-over-Any? exhaustiveness in ShareTargetParser. r=android-reviewers,mcarare https://github.com/mozilla-firefox/firefox/commit/a9505cebaf31 https://hg.mozilla.org/integration/autoland/rev/a2e671c2426c Replace never-invoked placeholder lambdas in TabGroupCard preview. r=android-reviewers,mcarare https://github.com/mozilla-firefox/firefox/commit/5cab737a0f6a https://hg.mozilla.org/integration/autoland/rev/1bc9f69bb7bb Fix "Expression is unused" warnings. r=android-reviewers,android-addons-reviewers,willdurand,mcarare https://github.com/mozilla-firefox/firefox/commit/ccb31cff77e8 https://hg.mozilla.org/integration/autoland/rev/d2785540a5af Suppress InflateParams for dialog layout inflations. r=android-reviewers,android-addons-reviewers,willdurand,mcarare

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.

Component: General → Tooling
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: