Explicitly keep default constructor in rules without members
R8 implicitly keeps the default constructor when no member rules are specified. Future versions of R8 will require apps to explicitly keep the default constructors that are required for the build to work.
This conservatively changes all keep rules that currently keep the default constructor to explicitly keep the default constructor.
Future work will attempt to tighten up the rules that do not require the default constructor to be kept.
Bug: 373579455
Test: existing
Change-Id: I74e5bec8c154358b3d841a06b688cfb0520f6e36
diff --git a/android/TerminalApp/proguard.flags b/android/TerminalApp/proguard.flags
index 88b8a9c..71ca304 100644
--- a/android/TerminalApp/proguard.flags
+++ b/android/TerminalApp/proguard.flags
@@ -16,10 +16,22 @@
# Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory,
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
--keep class * extends com.google.gson.TypeAdapter
--keep class * implements com.google.gson.TypeAdapterFactory
--keep class * implements com.google.gson.JsonSerializer
--keep class * implements com.google.gson.JsonDeserializer
+# TODO(b/373579455): Evaluate if <init> needs to be kept.
+-keep class * extends com.google.gson.TypeAdapter {
+ void <init>();
+}
+# TODO(b/373579455): Evaluate if <init> needs to be kept.
+-keep class * implements com.google.gson.TypeAdapterFactory {
+ void <init>();
+}
+# TODO(b/373579455): Evaluate if <init> needs to be kept.
+-keep class * implements com.google.gson.JsonSerializer {
+ void <init>();
+}
+# TODO(b/373579455): Evaluate if <init> needs to be kept.
+-keep class * implements com.google.gson.JsonDeserializer {
+ void <init>();
+}
# Prevent R8 from leaving Data object members always null
-keepclassmembers,allowobfuscation class * {
@@ -27,7 +39,13 @@
}
# Retain generic signatures of TypeToken and its subclasses with R8 version 3.0 and higher.
--keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken
--keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken
+# TODO(b/373579455): Evaluate if <init> needs to be kept.
+-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken {
+ void <init>();
+}
+# TODO(b/373579455): Evaluate if <init> needs to be kept.
+-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken {
+ void <init>();
+}
##---------------End: proguard configuration for Gson ----------