Allow to keep another class, method or field on mark-usage of another class...
Java class file shrinker, optimizer, obfuscator, and preverifier
Brought to you by:
guardsquare
Assume you have a class "A" with method "X" that dynamically loads class "B". I did not find a way to specify 'keep class "B" if method "A.X" is kept' in the current ProGuard configuration.
It would furthermore be helpful to specify such rules also by using annotations.
class A {
@KeepOtherClass(classname="B")
public X() {
...
}
}
Other helpful annotations might be:
@KeepOtherMethod(classname="B", methodname="Y")
@KeepOtherField(classname="B", fieldname="z")
Feel free to choose your own syntax for configuration file and annotations.
Thanks in advance,
Stefan
I was trying out the 6.0 beta with a rule like:
Where foo1() and foo2() both reflect on Bar. I was expecting "if foo1() OR foo2()" symantics, but it's "if foo1() AND foo2()" symantics. Is this intentional? Could it be the OR symantics instead?
The semantics are AND indeed, just like with -keepclasseswithmembers. You can get the OR semantics by specifying multiple -if/-keep options.