| # Copyright (c) 2020, the R8 project authors. Please see the AUTHORS file | |
| # for details. All rights reserved. Use of this source code is governed by a | |
| # BSD-style license that can be found in the LICENSE file. | |
| # Gson uses generic type information stored in a class file when working with fields. | |
| # R8 removes such information by default, so configure it to keep all of it. | |
| -keepattributes Signature | |
| -keepattributes EnclosingMethod | |
| -keepattributes InnerClasses | |
| # For using GSON @Expose annotation | |
| -keepattributes AnnotationDefault,RuntimeVisibleAnnotations | |
| # Gson specific classes | |
| -dontwarn sun.misc.Unsafe | |
| # Application classes that will be serialized/deserialized over Gson | |
| -keep class com.android.tools.r8.desugar.desugaredlibrary.gson.AllMapsTestClasses$Data { <fields>; } | |
| -keep class com.android.tools.r8.desugar.desugaredlibrary.gson.AllMapsTestClasses$NullableConcurrentHashMap | |
| -keep class com.android.tools.r8.desugar.desugaredlibrary.gson.AllMapsTestClasses$NullableHashMap | |
| -keep class com.android.tools.r8.desugar.desugaredlibrary.gson.AllMapsTestClasses$NullableMap | |
| -keep class com.android.tools.r8.desugar.desugaredlibrary.gson.AllMapsTestClasses$NullableConcurrentMap | |
| -keep class com.android.tools.r8.desugar.desugaredlibrary.gson.OptionalTestClass$Data { <fields>; } | |
| # Prevent R8 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 | |
| # Prevent R8 from leaving Data object members always null | |
| -keepclassmembers,allowobfuscation class * { | |
| @com.google.gson.annotations.SerializedName <fields>; | |
| } |