java - How to configure Proguard to keep static methods with different return times -


i have set of classes (more 50) contain few static methods called parse() returns instance of class. example of 1 of classes:

class sometype {     // parse methods    public static sometype parse(string text) { ... }    public static sometype parse(object obj) { ... }    ...     // other methods    public void static somethingstatic(...) { ... }    public void somethingnotstatic(...) { ... }    ... } 

i'm trying configure proguard obfuscate these classes , methods , fields except parse(...) methods. basically, want obfuscate class name, static , non-static methods, plus class fields.

i've tried use:

-keepclassmembers class sometype {   public static sometype parse(***); } 

and worked fine sometype, don't want have write rule each of 50 classes... how can generalize it?

i tried:

-keepclassmembers class ** {   public static * parse(***); } 

but proguard complains syntax of return type...

your rule correct, use *** return type, match any type:

-keepclassmembers class ** {    public static *** parse(***); } 

also -keepclassmembers preferred on -keepclasseswithmembers keep methods specify , not class (which not needed in case describe).

if have more 1 argument parse methods, should use:

-keepclassmembers class ** {    public static *** parse(...); } 

the ... match any number of arguments of any type.


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -