I defined an annotation named @KeepAll
.
I have an interface like
@KeepAll
public interface MainEntity {
//some methods
}
I want to keep all classes which implement this interface from obfuscation. Is this possible on ProGuard?
NOTE I know I can define it as
-keep public class * implements **.MainEntity
But I don't want to specify interface name but annotation name.
You can tell ProGuard to keep everything with an annotation like this:
-keep @com.google.inject.Singleton public interface *
The above would keep the interface itself from obfuscation.
To get the implementations of the interface you can do something like this:
So Right now I am confused what you want to achieve. If you only annotate the interface it wont be a help for ProGuard. The classes would need this annotation.
After a long trial and error process I get what I want. Here is the solution
Keep class names with annotation KeepAll;
Keep class members of classes and interface with annotation KeepAll;
Keep class members of a class which implemets a class that has KeepAll annotation. (This was what I want)