Shrinker fails to keep protected methods
Java class file shrinker, optimizer, obfuscator, and preverifier
Brought to you by:
guardsquare
When shrinking with the option:
-keepclasseswithmembers public class * {
protected *;
}
the following class is not preserved in the output jar:
public class Test {
public Test() {
\}
protected void doSomething\(String s\) \{
System.out.println\("Do
Something." + s);
}
}
Logged In: NO
logged by: Justin Walsh (justinw@medscheme.co.za)
Logged In: YES
user_id=555208
The specification
"protected *;"
is interpreted as
"protected <fields>;"
"protected <methods>;"
-keepclasseswithmembers then looks for classes that have at
least
one of each. This specification is so uncommon that I wonder
whether it is worth changing its behavior.
The intended specification is probably just "protected
<methods>;".
Even then, it is very unusual to try to keep all classes that
happen to have one or more protected methods. ProGuard doesn't
object and even handles the latter specification, but using
wildcards in the members of -keepclasseswithmembers is
probably not
a good idea.
I could add a check, along with some more checks for meaningless
specifications like
"abstract <fields>;"
Eric.