From fe392402c3e1893dc0416d7dec5a8554ee3408cc Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 25 Jun 2026 01:03:29 +0000 Subject: [PATCH 1/2] fix: extract MintPickerItem to fix Kotlin compiler OOM in MintPicker The deeply-nested Text() call inside DropdownMenu > forEach > DropdownMenuItem generated bytecode with MAXSTACK=26, which caused java.lang.OutOfMemoryError in the JVM bytecode frame analyzer (ConstantConditionEliminationMethodTransformer). Extracting DropdownMenuItem into a top-level private composable breaks the lambda nesting depth and lets the compiler succeed. Co-Authored-By: Claude Sonnet 4.6 Claude-Session: https://claude.ai/code/session_01SqmiRNcMEync2rVVbrPzWt --- .../loggedIn/wallet/CashuWalletScreen.kt | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/CashuWalletScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/CashuWalletScreen.kt index 0bd1784621..9c11e7369d 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/CashuWalletScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/CashuWalletScreen.kt @@ -1234,17 +1234,25 @@ private fun MintPicker( } DropdownMenu(expanded = expanded, onDismissRequest = { expanded = false }) { mints.forEach { m -> - DropdownMenuItem( - text = { Text(m) }, - onClick = { - onPick(m) - expanded = false - }, - ) + MintPickerItem(m) { + onPick(m) + expanded = false + } } } } +@Composable +private fun MintPickerItem( + mint: String, + onClick: () -> Unit, +) { + DropdownMenuItem( + text = { Text(mint) }, + onClick = onClick, + ) +} + // ============================================================================ // Send LN (melt) // ============================================================================ From 5662c89d11fc1f961f12969a82501092cb5970a0 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 25 Jun 2026 02:45:39 +0000 Subject: [PATCH 2/2] fix: extract ConsoleLogRow to fix Kotlin compiler OOM in BottomConsoleSheet The Text() calls inside the logs.forEach loop were 8 lambdas deep (Box > Column > AnimatedVisibility > Surface > Column > Column > forEach > Row), which caused java.lang.OutOfMemoryError in the Kotlin bytecode optimizer (ConstantConditionEliminationMethodTransformer). This broke CI when PR #3353 merged. Extract the Row content into a top-level ConsoleLogRow composable to reduce nesting depth. Co-Authored-By: Claude Sonnet 4.6 Claude-Session: https://claude.ai/code/session_01SqmiRNcMEync2rVVbrPzWt --- .../loggedIn/embed/BottomConsoleSheet.kt | 77 ++++++++++--------- 1 file changed, 41 insertions(+), 36 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/embed/BottomConsoleSheet.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/embed/BottomConsoleSheet.kt index 88604ae38d..af3a79e9be 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/embed/BottomConsoleSheet.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/embed/BottomConsoleSheet.kt @@ -128,43 +128,8 @@ fun BottomConsoleSheet( .verticalScroll(scrollState) .padding(horizontal = 8.dp, vertical = 4.dp), ) { - val dimColor = MaterialTheme.colorScheme.onSurfaceVariant logs.forEach { entry -> - val levelColor = consoleLevelColor(entry.level) - val srcShort = - entry.source - .substringAfterLast("/") - .substringAfterLast("\\") - .let { if (it.isBlank()) entry.source.takeLast(20) else it } - Row( - Modifier.fillMaxWidth().padding(vertical = 1.dp), - verticalAlignment = Alignment.Top, - ) { - Text( - consoleLevelChar(entry.level), - color = levelColor, - fontFamily = FontFamily.Monospace, - fontSize = 11.sp, - modifier = Modifier.width(14.dp), - ) - Spacer(Modifier.width(4.dp)) - Text( - buildAnnotatedString { - withStyle(SpanStyle(color = levelColor)) { - append(entry.message) - } - if (srcShort.isNotBlank()) { - withStyle(SpanStyle(color = dimColor)) { - append(" $srcShort:${entry.lineNumber}") - } - } - }, - fontFamily = FontFamily.Monospace, - fontSize = 11.sp, - modifier = Modifier.weight(1f), - overflow = TextOverflow.Visible, - ) - } + ConsoleLogRow(entry) } } } @@ -203,6 +168,46 @@ fun BottomConsoleSheet( } } +@Composable +private fun ConsoleLogRow(entry: ConsoleLogEntry) { + val levelColor = consoleLevelColor(entry.level) + val dimColor = MaterialTheme.colorScheme.onSurfaceVariant + val srcShort = + entry.source + .substringAfterLast("/") + .substringAfterLast("\\") + .let { if (it.isBlank()) entry.source.takeLast(20) else it } + Row( + Modifier.fillMaxWidth().padding(vertical = 1.dp), + verticalAlignment = Alignment.Top, + ) { + Text( + consoleLevelChar(entry.level), + color = levelColor, + fontFamily = FontFamily.Monospace, + fontSize = 11.sp, + modifier = Modifier.width(14.dp), + ) + Spacer(Modifier.width(4.dp)) + Text( + buildAnnotatedString { + withStyle(SpanStyle(color = levelColor)) { + append(entry.message) + } + if (srcShort.isNotBlank()) { + withStyle(SpanStyle(color = dimColor)) { + append(" $srcShort:${entry.lineNumber}") + } + } + }, + fontFamily = FontFamily.Monospace, + fontSize = 11.sp, + modifier = Modifier.weight(1f), + overflow = TextOverflow.Visible, + ) + } +} + @Composable private fun consoleLevelColor(level: String): Color { val warningAmber = if (isSystemInDarkTheme()) Color(0xFFFFB74D) else Color(0xFFE65100)