xref: /aosp_15_r20/external/kotlinx.serialization/rules/r8.pro (revision 57b5a4a64c534cf7f27ac9427ceab07f3d8ed3d8)
1*57b5a4a6SAndroid Build Coastguard Worker# Rule to save runtime annotations on serializable class.
2*57b5a4a6SAndroid Build Coastguard Worker# If the R8 full mode is used, annotations are removed from classes-files.
3*57b5a4a6SAndroid Build Coastguard Worker#
4*57b5a4a6SAndroid Build Coastguard Worker# For the annotation serializer, it is necessary to read the `Serializable` annotation inside the serializer<T>() function - if it is present,
5*57b5a4a6SAndroid Build Coastguard Worker# then `SealedClassSerializer` is used, if absent, then `PolymorphicSerializer'.
6*57b5a4a6SAndroid Build Coastguard Worker#
7*57b5a4a6SAndroid Build Coastguard Worker# When using R8 full mode, all interfaces will be serialized using `PolymorphicSerializer`.
8*57b5a4a6SAndroid Build Coastguard Worker#
9*57b5a4a6SAndroid Build Coastguard Worker# see https://github.com/Kotlin/kotlinx.serialization/issues/2050
10*57b5a4a6SAndroid Build Coastguard Worker
11*57b5a4a6SAndroid Build Coastguard Worker -if @kotlinx.serialization.Serializable class **
12*57b5a4a6SAndroid Build Coastguard Worker -keep, allowshrinking, allowoptimization, allowobfuscation, allowaccessmodification class <1>
13