fix: clear compiler warnings across all modules

Sweep of Kotlin compiler warnings in every module's main source sets
(quartz, commons, cli, desktopApp, amethyst, nappletHost).

Genuine code fixes:
- Drop unnecessary !!/safe-calls and redundant elvis/casts (OkHttp's
  now-non-null `body`, smart-cast callbacks, non-null String receivers).
- Remove provably-redundant conditions (`canvas == null` after a
  non-null content check; `account != null` implied by `canModerate`).
- Migrate deprecated kotlinx.collections.immutable persistent ops
  (add/remove/put/addAll -> adding/removing/putting/addingAll).
- Migrate LocalClipboardManager -> LocalClipboard (+ scoped setText),
  ContextCompat.startActivity -> context.startActivity, TabRow ->
  SecondaryTabRow, and @ConsistentCopyVisibility on a private-ctor data class.
- Delete dead ReceiveDialog.onGenerate param (never invoked).
- Fix a platform-Boolean type-mismatch on a ThreadLocal read.

Deprecations with no available successor are narrowly @Suppress-ed with
a reason: androidx.security.crypto (EncryptedSharedPreferences/MasterKey),
androidx.privacysandbox.ui, WebView.databaseEnabled, BluetoothDevice
.connectGatt, media3 setEnableAudioTrackPlaybackParams, FirebaseMessaging
.token, and InputMethodManager.SHOW_IMPLICIT.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015Xb9YbBqhdZsHxMzitmyvn
This commit is contained in:
Claude
2026-07-24 16:36:17 +00:00
parent c6fd7095d4
commit a7748dfda5
39 changed files with 90 additions and 75 deletions
@@ -300,7 +300,7 @@ class Context(
.header("Accept", "application/nostr+json")
.build()
okhttp.newCall(request).execute().use { resp ->
resp.body?.string()?.let { Nip11RelayInformation.fromJson(it) }
resp.body.string().let { Nip11RelayInformation.fromJson(it) }
}
}.getOrNull()
}
@@ -380,7 +380,7 @@ object BuzzCommands {
.get()
.build(),
).execute()
.use { it.code to (it.body?.string() ?: "") }
.use { it.code to it.body.string() }
}
private suspend fun httpPost(
@@ -392,7 +392,7 @@ object BuzzCommands {
withContext(Dispatchers.IO) {
val builder = Request.Builder().url(url).post(body.toRequestBody(jsonMedia))
if (auth != null) builder.header("Authorization", auth)
http.newCall(builder.build()).execute().use { it.code to (it.body?.string() ?: "") }
http.newCall(builder.build()).execute().use { it.code to it.body.string() }
}
/** `buzz post RELAY GID <text>` → publishes a kind-40002 stream message with an `h` tag. */
@@ -578,7 +578,7 @@ object BuzzCommands {
.groupBy { it.slug() }
.values
.mapNotNull { versions -> versions.maxByOrNull { it.createdAt } }
.sortedBy { it.personaOrNull()?.displayName ?: it.slug() ?: "" }
.sortedBy { it.personaOrNull()?.displayName ?: it.slug() }
.map {
val content = it.personaOrNull()
mapOf(
@@ -113,7 +113,7 @@ object GitPatchCommands {
"event_id" to signed.id,
"kind" to signed.kind,
"repository" to Address.assemble(addr.kind, addr.pubKeyHex, addr.dTag),
"subject" to (signed as? GitPatchEvent)?.subject(),
"subject" to signed.subject(),
) + RawEventSupport.ackFields(ack),
)
return 0
@@ -133,6 +133,7 @@ object GitReadCommands {
* comment trees and PR-update (1619) events (which use NIP-22 uppercase `E`)
* are out of scope here.
*/
@Suppress("DEPRECATION") // legacy kind:1622 GitReplyEvent is read for backward compatibility.
suspend fun thread(
dataDir: DataDir,
rest: Array<String>,