Skip to content

Commit 5e69a2b

Browse files
fix(proguard): update rules to preserve enum constants and collection interfaces for Moshi (#10698)
2 parents ff3588f + cc4c247 commit 5e69a2b

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

app-k9mail/proguard-rules.pro

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,13 @@
6262
-dontwarn org.slf4j.impl.StaticLoggerBinder
6363

6464
-keep,allowshrinking class com.tokenautocomplete.TokenCompleteTextView
65+
66+
# Moshi's EnumJsonAdapter uses Class.getField() to map JSON strings to enum constants.
67+
# R8's enum optimization rewrites switch statements to use ordinals, making enum fields
68+
# appear unused, which causes R8 to strip them. This rule preserves all enum constants
69+
# so Moshi can deserialize them at runtime (e.g. via PendingCommandSerializer).
70+
-keep class net.thunderbird.core.common.mail.Flag { *; }
71+
72+
# Moshi uses reflection to read field types. R8 can rewrite List/Map to ArrayList/HashMap,
73+
# which breaks Moshi's collection interface requirement.
74+
-keep class com.fsck.k9.controller.MessagingControllerCommands$* { *; }

app-thunderbird/proguard-rules.pro

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,13 @@
6262
-dontwarn org.slf4j.impl.StaticLoggerBinder
6363

6464
-keep,allowshrinking class com.tokenautocomplete.TokenCompleteTextView
65+
66+
# Moshi's EnumJsonAdapter uses Class.getField() to map JSON strings to enum constants.
67+
# R8's enum optimization rewrites switch statements to use ordinals, making enum fields
68+
# appear unused, which causes R8 to strip them. This rule preserves all enum constants
69+
# so Moshi can deserialize them at runtime (e.g. via PendingCommandSerializer).
70+
-keep class net.thunderbird.core.common.mail.Flag { *; }
71+
72+
# Moshi uses reflection to read field types. R8 can rewrite List/Map to ArrayList/HashMap,
73+
# which breaks Moshi's collection interface requirement.
74+
-keep class com.fsck.k9.controller.MessagingControllerCommands$* { *; }

0 commit comments

Comments
 (0)