5 April 2010

Evolution of Java Platform Classes

Back in 2006 I started creating a list of all Java classes available in the Java runtime. I wrote about the new classes of Java 5 and Java 6 in the past. Such lists of classes come handy if you want to know all classes of the JDK/ Standard Edition or if you want to be a Java Champion like Heinz Kabutz. I mention Heinz because I mailed him my lists some time ago and he confessed that he had not known that Short and Void were added with Java 1.1. Shame on you Heinz ;-) He said it was difficult to get these really old Java versions nowadays.

And there were really interesting things happening. Sometimes private (package access) classes were promoted to public top level ones. This happened in almost all major upgrades,
  • from JDK 1.1 to J2SE 1.2
    java.io.ObjectStreamConstants
    java.io.ObjectStreamField
    java.net.SocketOptions
  • from J2SE 1.2 to J2SE 1.3
    java.awt.datatransfer.MimeTypeParseException
    java.awt.font.TextMeasurer
    javax.swing.plaf.basic.BasicHTML
    javax.swing.plaf.metal.MetalInternalFrameTitlePane
  • from J2SE 1.3 to J2SE 1.4
    java.awt.ScrollPaneAdjustable
    javax.swing.Popup
    javax.swing.PopupFactory
    javax.swing.text.html.ImageView
    
  • from Java 5 to Java 6
    java.awt.GridBagLayoutInfo
    javax.management.loading.MLetContent
    
The Disappearing Gnomes!!While these classes appeared as new ones in the specified release, they have been around inside their package for at least two years. Some of them, e.g. ObjectStreamConstants states a (for this list) correct @since JDK 1.1, whereas others show the Java version they became public in their @since tag. I guess their JavaDoc was added when they were made public, or maybe they have been rewritten? This must be true for java.text.Normalizer which was available as package access class in Java 1.3, then dropped in Java 1.4 and came back as a public class in Java 1.6.

The opposite change, from public to private class, is rare. I only found one class, javax.management.timer TimerAlarmClockNotification, which was removed from the public API in Java 6. It was added with Java 5 but marked as deprecated. I guess it came in with JMX 1.1 where it had been deprecated for some time.

According to my list there are only two classes that ever disappeared completely from the JDK, java.text.resources DateFormatZoneData and javax.swing.beaninfo SwingBeanInfo. The DateFormatZoneData was inside i18n.jar which was removed in 1.4 and SwingBeanInfo even lived inside lib/dt.jar, far away from jre/lib/rt.jar, which indicated it had been created to be used by development tools only.