How to tell proguard to keep enum constants and fields

后端 未结 2 1492
借酒劲吻你
借酒劲吻你 2020-12-14 08:10

I\'ve try obfuscate our web application which use spring, jaxb and relies on annotations, and reflection heavily. I apply many recipes found in internet to keep some classes

相关标签:
2条回答
  • 2020-12-14 08:20

    Thanks to http://sourceforge.net/p/proguard/discussion/182455/thread/1c28f199/ I found solution for my question (<⁠fields> must be added):

    -keepclassmembers class * extends java.lang.Enum {
        <fields>;
        public static **[] values();
        public static ** valueOf(java.lang.String);
    }
    
    0 讨论(0)
  • 2020-12-14 08:20

    This worked fine for me.

    -keep public enum com.company.appname.**{
        *;
    }
    

    Where ** is package and subpackages.

    0 讨论(0)
提交回复
热议问题