(static) final primitive variables
Java class file shrinker, optimizer, obfuscator, and preverifier
Brought to you by:
guardsquare
primitive variables, such as int, byte, short, etc. that are declared (static) final should have an option to be removed and their value be used to replace them.. Example..
public static final int i2k = 88;
public static void x()
{
//Some Code
exec(i2k);
}
public static void exec(int i)
{
//Some Code
}
Would become
public static void x()
{
//Some Code
exec(88);
}
public static void exec(int i)
{
//Some Code
}
I could be wrong in assuming that this is not implemented or that the compiler does not do this automatically, however - in my honest opinion - I believe that it should be something that is done at some stage.
All java compilers already inline such constants where they are used. ProGuard then removes the definition. ProGuard also further propagates the constant argument in the second method and then removes the argument.