diff options
author | Ryan O'Leary <ryanaoleary@google.com> | 2022-07-14 20:00:10 +0000 |
---|---|---|
committer | Cherrypicker Worker <android-build-cherrypicker-worker@google.com> | 2022-10-07 22:54:17 +0000 |
commit | 7c3d4069aa81a8484134abbfe38215b52deb3048 (patch) | |
tree | 12314d73878bd018f3edaa02a0e406fbe4a1be11 | |
parent | aab1821020a5cf64b3603fb3787746b65ce24a3a (diff) | |
download | DeskClock-7c3d4069aa81a8484134abbfe38215b52deb3048.tar.gz |
Fix for: error: 'when' expression must be exhaustive, add necessary 'null' branch or 'else' branch insteadandroid-13.0.0_r82android-13.0.0_r81android-13.0.0_r80android-13.0.0_r74android-13.0.0_r73android-13.0.0_r72android-13.0.0_r66android-13.0.0_r65android-13.0.0_r64android-13.0.0_r60android-13.0.0_r59android-13.0.0_r58android13-qpr3-c-s8-releaseandroid13-qpr3-c-s7-releaseandroid13-qpr3-c-s6-releaseandroid13-qpr3-c-s5-releaseandroid13-qpr3-c-s4-releaseandroid13-qpr3-c-s3-releaseandroid13-qpr3-c-s2-releaseandroid13-qpr3-c-s12-releaseandroid13-qpr3-c-s11-releaseandroid13-qpr3-c-s10-releaseandroid13-qpr3-c-s1-release
AOSP DeskClock contains multiple warnings that become errors when updating to Kotlin 1.7. One such error is that 'when' expressions must be exhaustive (even if all cases are functionally covered). A simple fix for this is to simply add an empty null branch (i.e. null -> { }) at the end of the when statement.
Bug: 237017037
Test: Ran `adb shell am instrument -w com.android.deskclock.tests` with
output:
Time: 54.056
OK (68 tests)
Change-Id: Icfbeaf6d380efcc17cc02bc8299c9ba64c202d2e
(cherry picked from commit 2d796a4ee72adf6d2016f7650c50b8eb6ec0c8e7)
Merged-In: Icfbeaf6d380efcc17cc02bc8299c9ba64c202d2e
-rw-r--r-- | src/com/android/deskclock/alarms/AlarmActivity.kt | 1 | ||||
-rw-r--r-- | src/com/android/deskclock/timer/TimerItem.kt | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/src/com/android/deskclock/alarms/AlarmActivity.kt b/src/com/android/deskclock/alarms/AlarmActivity.kt index a4caf1a74..8d9535de0 100644 --- a/src/com/android/deskclock/alarms/AlarmActivity.kt +++ b/src/com/android/deskclock/alarms/AlarmActivity.kt @@ -283,6 +283,7 @@ class AlarmActivity : BaseActivity(), View.OnClickListener, View.OnTouchListener } AlarmVolumeButtonBehavior.NOTHING -> { } + null -> { } } } } diff --git a/src/com/android/deskclock/timer/TimerItem.kt b/src/com/android/deskclock/timer/TimerItem.kt index 9cdcca438..a0573cf18 100644 --- a/src/com/android/deskclock/timer/TimerItem.kt +++ b/src/com/android/deskclock/timer/TimerItem.kt @@ -138,6 +138,7 @@ class TimerItem @JvmOverloads constructor( mTimerText.isActivated = true mTimerText.importantForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_NO } + null -> { } } } } |