Update compatibility-doc to keep TypeToken for compat mode
Bug: b/247146909
Change-Id: I30416817d68af64d2b7e2722d63ce903bf1e8527
diff --git a/compatibility-faq.md b/compatibility-faq.md
index 3ba23c8..8ca09d5 100644
--- a/compatibility-faq.md
+++ b/compatibility-faq.md
@@ -129,7 +129,7 @@
the fields to be renamed by R8 to the same name, but GSON serialization will
work as expected.
-### GSON with full mode
+### GSON
GSON uses type tokens to serialize and deserialize generic types.
@@ -138,7 +138,7 @@
The anonymous class will have a generic signature argument of `List<String>` to
the super type `TypeToken` that is reflective read for serialization. It
is therefore necessary to keep both the `Signature` attribute, the
-`com.google.gson.reflect.TypeToken` class and all sub-types:
+`com.google.gson.reflect.TypeToken` class and all sub-types.
```
-keepattributes Signature
@@ -146,6 +146,9 @@
-keep class * extends com.google.gson.reflect.TypeToken
```
+This is also needed for R8 in compat mode since multiple optimizations will
+remove the generic signature such as class merging and argument removal.
+
## Retrofit
### Objects instantiated with Retrofit's `create()` method are always replaced with `null`