Gili
Why doesn't jarjar strip out unused static methods? I believe
Proguard does.
2008/10/27 Gili Tzabari <gili.t...@gmail.com>
Why doesn't jarjar strip out unused static methods? I believe
Proguard does.
no idea, certainly that would help although you want to make
sure static methods that form part of the public API are kept
(like the ones in the Guice class)
but that's just a configuration detail, should still be possible...
based on a quick hack of the Guice codebase to switch to reducedversions of Maps, Lists, etc. (as the number of statics used is small)
we could shrink the jar to at least 600k, ie. a saving of 30%
hmm, I might take a peek at hacking JarJar to do this :)
2008/10/27 Stuart McCulloch <mcc...@gmail.com>based on a quick hack of the Guice codebase to switch to reducedversions of Maps, Lists, etc. (as the number of statics used is small)
we could shrink the jar to at least 600k, ie. a saving of 30%
hmm, I might take a peek at hacking JarJar to do this :)
FYI, I tried switching to use proguard but I couldn't find a way to make
proguard rename the packages but keep the original class names :(
# Referenced by ReflectUtils.newInstance
-keepclassmembers class com.google.inject.cglib.reflect.FastClass
{
<init>(java.lang.Class);
}
# Referenced by com.google.inject.cglib.proxy.Enhancer.getCallbacksSetter
-keep class com.google.inject.cglib.proxy.MethodProxy
{
*;
}
# Referenced by cglib-enhanced proxies
-keep class com.google.inject.cglib.core.ReflectUtils
{
public <methods>;
}
# Referenced by cglib proxies
-keep class com.google.inject.cglib.proxy.MethodInterceptor
{
public java.lang.Object intercept(java.lang.Object,
java.lang.reflect.Method, java.lang.Object[],
com.google.inject.cglib.proxy.MethodProxy);
}
Gili
Stuart McCulloch wrote:
> 2008/10/27 Stuart McCulloch <mcc...@gmail.com <mailto:mcc...@gmail.com>>
>
> 2008/10/27 Stuart McCulloch <mcc...@gmail.com
> <mailto:mcc...@gmail.com>>
I'm thinking that maybe all you need is a Proguard configuration
(above and more below) and some third-party (such as JarJar) to move
some packages around and you're done. You'd run Proguard with
shrinking enabled, obfuscation disabled, and look into whether
optimization should be enabled or not.
Here is the second part of the Proguard configuration you will need to
prevent Guice-specific classes from being removed:
# Referenced by com.google.inject.AbstractModule
-keep class com.google.inject.Binder
{
*;
}
# Keep any constructors annotated with @Inject
-keepclassmembers class *
{
@com.google.inject.Inject <init>(...);
}
At least, this is what I used for Guice 1.0