All
I am using proguard to obfuscate a scala application.
At this point I am using very little of the scala-library, but still my jar is ~300KB, 99% of it are scala-library classes.
Using the -whyareyoukeeping option, I see that it keeps any class that overrides java.lang.Object methods, such as "toString" or "equals". For example
scala.Some
is invoked by scala.Some.equals (300:300)
implements java.lang.Object.equals
is a library method.
And so scala.Some class is kept although I am not using it in my code.
Is there anyway to fix this, so that I only keep the classes I am actually using in my code?
Thanks Amir
ProGuard's answer to -whyareyoukeeping
sometimes contains a circular reasoning, unfortunately. The shrinking operation is correct though. The class is not preserved because it overrides equals(), but because it is actually referenced by some other class that is required. You may get a better impression by querying other classes.
Even a small piece of Scala can drag in a lot of basic classes due to transitive dependencies (often surprising at first sight). A final size of 300k doesn't seem out of the ordinary, compared to the original size of many megabytes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With