- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Proguarding scala-library.jar (2.9)
Sun, 2011-05-15, 20:39
Hi,
I'm trying to proguard scala-library.jar to make it smaller. The most
recent ProGuard 4.6 outputs:
ProGuard, version 4.6
Reading program jar
[C:\Users\Piotr\Projekty\proguard-scala\scala-library.jar]
Reading library jar [C:\Program Files\Java\jre6\lib\rt.jar]
Warning: scala.Array: can't find referenced class
scala.Array$$anonfun$ofDim$1
Warning: scala.Array$: can't find referenced class
scala.Array$$anonfun$ofDim$1
Warning: scala.Either: can't find referenced class
scala.Either$$anonfun$joinLeft$1
Warning: scala.Either: can't find referenced class
scala.Either$$anonfun$joinRight$1
Warning: scala.Either$: can't find referenced class
scala.Either$$anonfun$joinLeft$1
Warning: scala.Either$: can't find referenced class
scala.Either$$anonfun$joinRight$1
Warning: scala.actors.Futures: can't find referenced class
scala.actors.Futures$$anonfun$awaitAll$1
Warning: scala.actors.Futures$: can't find referenced class
scala.actors.Futures$$anonfun$awaitAll$1
Warning: scala.collection.BitSetLike: can't find referenced class
scala.collection.BitSetLike$$anonfun$$up$1
Warning: scala.collection.BitSetLike: can't find referenced class
scala.collection.BitSetLike$$anonfun$$bar$1
Warning: scala.collection.BitSetLike: can't find referenced class
scala.collection.BitSetLike$$anonfun$$amp$1
Warning: scala.collection.BitSetLike: can't find referenced class
scala.collection.BitSetLike$$anonfun$addString$1
Warning: scala.collection.BitSetLike: can't find referenced class
scala.collection.BitSetLike$$anonfun$$amp$tilde$1
Warning: scala.collection.BitSetLike$: can't find referenced class
scala.collection.BitSetLike$$anonfun$$up$1
Warning: scala.collection.BitSetLike$: can't find referenced class
scala.collection.BitSetLike$$anonfun$$bar$1
Warning: scala.collection.BitSetLike$: can't find referenced class
scala.collection.BitSetLike$$anonfun$$amp$1
Warning: scala.collection.BitSetLike$: can't find referenced class
scala.collection.BitSetLike$$anonfun$addString$1
Warning: scala.collection.BitSetLike$: can't find referenced class
scala.collection.BitSetLike$$anonfun$$amp$tilde$1
Warning: scala.collection.GenSeqViewLike$Filtered: can't find referenced
class scala.collection.GenSeqViewLike$Filtered$$anonfun$index$2
...
Can it be a ProGuard bug, or are these classes really somewhere else
(not in the scala-library.jar)?
Regards,
Piotr
I don't know if you figured this out yet, but I just had the same
issue and thought I would capture it what I have learned today here.
The first thing that I learned is that Proguard can require lots of
configuration to do the right thing. It can have lots of false alarms
due to the fact that it must try to ensure that everything will be
present that need to be. I seems that the trick is to be carefull to
mask off false alarms without shooting yourself in the foot and
allowing it to remove classes that you actually need.
Checkout the scala sample in the proguard manual.
http://proguard.sourceforge.net/index.html#/manual/examples.html
You will see
-dontwarn **$$anonfun$*
Which means that for your question, there really isn't anything wrong,
and the right thing to do is to mask off the anonfun warnings. See
the example for more of these.
The second thing that I learned is that some libraries are full of
issues that require you to hand tune the configuration to be happy
with the library. For me, my worst offender is the H2 database that
has lots of dynamic class accesses that require you to include all the
possible members with configuration entries.
James
2011/5/15 Piotr Kołaczkowski :
> Hi,
>
> I'm trying to proguard scala-library.jar to make it smaller. The most recent
> ProGuard 4.6 outputs:
>
> ProGuard, version 4.6
> Reading program jar
> [C:\Users\Piotr\Projekty\proguard-scala\scala-library.jar]
> Reading library jar [C:\Program Files\Java\jre6\lib\rt.jar]
> Warning: scala.Array: can't find referenced class
> scala.Array$$anonfun$ofDim$1
> Warning: scala.Array$: can't find referenced class
> scala.Array$$anonfun$ofDim$1
> Warning: scala.Either: can't find referenced class
> scala.Either$$anonfun$joinLeft$1
> Warning: scala.Either: can't find referenced class
> scala.Either$$anonfun$joinRight$1
> Warning: scala.Either$: can't find referenced class
> scala.Either$$anonfun$joinLeft$1
> Warning: scala.Either$: can't find referenced class
> scala.Either$$anonfun$joinRight$1
> Warning: scala.actors.Futures: can't find referenced class
> scala.actors.Futures$$anonfun$awaitAll$1
> Warning: scala.actors.Futures$: can't find referenced class
> scala.actors.Futures$$anonfun$awaitAll$1
> Warning: scala.collection.BitSetLike: can't find referenced class
> scala.collection.BitSetLike$$anonfun$$up$1
> Warning: scala.collection.BitSetLike: can't find referenced class
> scala.collection.BitSetLike$$anonfun$$bar$1
> Warning: scala.collection.BitSetLike: can't find referenced class
> scala.collection.BitSetLike$$anonfun$$amp$1
> Warning: scala.collection.BitSetLike: can't find referenced class
> scala.collection.BitSetLike$$anonfun$addString$1
> Warning: scala.collection.BitSetLike: can't find referenced class
> scala.collection.BitSetLike$$anonfun$$amp$tilde$1
> Warning: scala.collection.BitSetLike$: can't find referenced class
> scala.collection.BitSetLike$$anonfun$$up$1
> Warning: scala.collection.BitSetLike$: can't find referenced class
> scala.collection.BitSetLike$$anonfun$$bar$1
> Warning: scala.collection.BitSetLike$: can't find referenced class
> scala.collection.BitSetLike$$anonfun$$amp$1
> Warning: scala.collection.BitSetLike$: can't find referenced class
> scala.collection.BitSetLike$$anonfun$addString$1
> Warning: scala.collection.BitSetLike$: can't find referenced class
> scala.collection.BitSetLike$$anonfun$$amp$tilde$1
> Warning: scala.collection.GenSeqViewLike$Filtered: can't find referenced
> class scala.collection.GenSeqViewLike$Filtered$$anonfun$index$2
> ...
>
>
> Can it be a ProGuard bug, or are these classes really somewhere else (not in
> the scala-library.jar)?
>
> Regards,
> Piotr
>
>
>