How do I configure proguard/R8 to keep all the fields and methods of a class if the class contains an annotated field?
I have a class
public class MyDocument {
@DocumentId
private String foo;
private String bar;
public getFoo() { .. }
public getBar() { .. }
}
I was able to make it not remove foo
with
-keepclassmembers class * {
@a.b.c.DocumentId <fields>;
@a.b.c.DocumentId <methods>;
}
But it still removes getBar()
Is there any way to say "don't remove any methods or fields in a class if one of the fields in the same class contains the annotation?
The usecase here is that they are DTO classes used by firestore's toObject
I don't want to do the matching based on the name of the class since this rule will apply to many classes.