From cdfb197c545ec9cb2867994e6bb8a5a28f46bc17 Mon Sep 17 00:00:00 2001 From: Carlos Rafael Giani Date: Sun, 6 Nov 2022 16:29:07 +0100 Subject: [PATCH] combov2: Minor cleanup to reduce some code smell * Kotlin code convention specifies that ignored exceptions must be named "_", not "ignored." * Add explanation about empty overridden method implementations. Signed-off-by: Carlos Rafael Giani --- .../androidaps/plugins/pump/combov2/ComboV2Plugin.kt | 8 ++++---- .../pump/combov2/activities/ComboV2PairingActivity.kt | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/ComboV2Plugin.kt b/pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/ComboV2Plugin.kt index f39c190428..0f01118b4f 100644 --- a/pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/ComboV2Plugin.kt +++ b/pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/ComboV2Plugin.kt @@ -619,7 +619,7 @@ class ComboV2Plugin @Inject constructor ( } } catch (e: CancellationException) { throw e - } catch (ignored: Exception) { + } catch (_: Exception) { } } @@ -1370,7 +1370,7 @@ class ComboV2Plugin @Inject constructor ( suspend fun providePairingPIN(pairingPIN: PairingPIN) { try { pairingPINChannel?.send(pairingPIN) - } catch (ignored: ClosedSendChannelException) { + } catch (_: ClosedSendChannelException) { } } @@ -1384,8 +1384,8 @@ class ComboV2Plugin @Inject constructor ( val pump = pumpManager?.acquirePump(bluetoothAddress) ?: return@runBlocking pump.unpair() pumpManager?.releasePump(bluetoothAddress) - } catch (ignored: ComboException) { - } catch (ignored: BluetoothException) { + } catch (_: ComboException) { + } catch (_: BluetoothException) { } } diff --git a/pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/activities/ComboV2PairingActivity.kt b/pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/activities/ComboV2PairingActivity.kt index d4db4ef718..9e5de7d6f9 100644 --- a/pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/activities/ComboV2PairingActivity.kt +++ b/pump/combov2/src/main/kotlin/info/nightscout/androidaps/plugins/pump/combov2/activities/ComboV2PairingActivity.kt @@ -69,9 +69,13 @@ class ComboV2PairingActivity : NoSplashAppCompatActivity() { // xxx xxx xxxx binding.combov2PinEntryEdit.addTextChangedListener(object : TextWatcher { override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) { + // Nothing needs to be done here; overridden method only exists + // to properly and fully implement the TextWatcher interface. } override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { + // Nothing needs to be done here; overridden method only exists + // to properly and fully implement the TextWatcher interface. } override fun afterTextChanged(s: Editable?) {