Legacy

I decided today that I would take a look at a long-standing yet still active project, the bulk of which is in Java and running quite well under the latest v17 (LTS). In particular I wanted to know how much of the library of dependencies was compiled with earlier versions of Java. The result makes for some interesting reading.

My strategy was to extract the classes from every Jar and examine the version ID in the preamble bytes. I would then weight the discovered versions by the size of the class files (in uncompressed bytes), because counting files or lines of code is so unreliable.

From a total sample of about 5Gb of Java class bytes, only half of one percent was compiled for Java 11, and none were compiled for a more recent version. The most common was Java 6 (37%) and the oldest was Java 1.1 (2.5%). The full figures are:

Version Percentage
1.1 2.54
1.2 0.55
1.3 13.16
1.4 2.81
5.0 10.46
6.0 37.32
7 15.39
8 17.25
9 0.03
11 0.48

The rare Java 9 classes were found in the META-INF/versions/9 directory of a JAXB library, the only time I’ve actually encountered a multi-release Jar in the wild. It’s also not surprising that JAXB is involved, given the migration to Jakarta and the mass of package renaming involved. However, while I appreciate the advantage of having a library that is compatible with new and legacy environments, I think I’d rather have separate builds of these resources, targeted specifically for their respective deployment environments.

Categorised as: Coding, Technology

Comment Free Zone

Comments are closed.