[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: optimizing for size



> I've been thinking about a relatively simple technique to achieve this:
> generating static forwarding methods.  If I have N classes that call a
> system class method, the system class and method name is repeated N
> times in the constant pools, and obfuscators can't touch the strings.
> Those calls could be replaced by an application-defined static method
> that calls the system class method, and the obfuscator will then
> compress that class/method name in the N original class files.  I'm not
> sure where the break-even point is in terms of overall space yet.


That's an interesting idea.  One thing to look out for, besides calls, is
method parameters and return types.  Method signatures are encoded
separately from class declarations in the constant pool.  For example, the
parameters of "main" will be "([Ljava/lang/String;)V", and there will also
be an entry for "java/lang/String" by itself in the constant pool
(assuming the class uses String somewhere).