I have a class with static methods for logging, eg:
I'm attempting to remove all these using ProGuard. I don't want to just disable them (That done using logic anyway), I want them to disappear when decompiled.
It is successfully removing the calls to my logging methods, but leaves behind the strings that were concatenated. It completely removes the strings that were fixed.
This is my ProGuard setting:
-assumenosideeffects class com.mypackage.Log { *; }
This is my source:
void doSomething(String name) {
Log.verbose("Hello!");
Log.verbose("My name is " + name);
...
}
This is what it decompiles to:
void a(String a) {
new StringBuilder("My name is ").append(a);
...
}
This is what I want it to decompile to:
void a(String a) {
...
}
For this example, assume that the name parameter is used later on in the method (ie, it shouldn't be optimized out completely).
Should I also be using assumenosideeffects
for StringBuilder? I do use StringBuilders elsewhere, that I do want to keep. Would that remove them there, too?