The following is a visualization of the relative size of the packages – measured in terms of the number of bytecode instructions – of Oracle JDK 1.8.0's runtime jar (rt.jar) for Mac OS X.
As you can see, the java
package and its subpackages contains a major part of the code.
Another major package is (more or less as expected) the javax
package. (JavaFX is stored in another jar and is not considered here.)
However, it is very interesting that more than half of the code belongs to packages (com
and sun
) that are not intended to be used by the regular Java developer.
To get more detailed information on a package and its sub-packages just
The visualization was created using: JavaScript InfoVis Toolkit.
The analysis was written using the OPAL Bytecode toolkit and is shown next (5 lines of boilerplate and 12 lines for the analysis).
object InstructionStatistics extends AnalysisApplication {
val analysis = new Analysis[URL, BasicReport] {
def description: String = "Collects information about the number of instructions per package."
def analyze(project: Project[URL], parameters: Seq[String]) = {
import scala.collection.mutable.{ HashSet, HashMap }
// FQPN = FullyQualifiedPackageName
val instructionsPerFQPN = HashMap.empty[String, Int]
for {
classFile <- project.allClassFiles
packageName = classFile.thisType.packageName
MethodWithBody(body) <- classFile.methods
} {
instructionsPerFQPN.update(
packageName,
instructionsPerFQPN.getOrElse(packageName, 0) + body.programCounters.size)
}
val json : String = // generate the JSON
BasicReport(json)
}
}
}