I was trying to create a minimal Scala runtime for one of my applications. I pack Scala runtime inside that program's Jar, but do not use some of the feature. So I thought I would be able to remove some of those classes. The Jar is almost 20M big, once I pack all the dependencies. And the Scala runtime is the largest.
But it is not as easy as you would think. At first glance I thought I would be able to remove scala.beans, scala.annotation, scala.xml and so on. But no... For example, scala.xml is referenced in Predef.scala:
// Apparently needed for the xml library
val $scope = scala.xml.TopScope
And, as you know, Predef is silently included in every Scala compilation. And its implicits are very useful. I appreciated a comment. Apparently, a single line requires me to include 2Mb of class files I do not really use.
Scala is a great language. It allows developer to be very fast and efficient. But... Its runtime is not among the lightest and good luck shrinking it.