Migrating to Java 6

I work with a large code base consisting of over 4,000 classes, with a custom ORM persistence layer, layout managers, Rapid Application Development (RAD) User Interface (UI) builder. The code is written in Java 1.4.2 but we have been considering a move to Java 5 or even up to Java 6. We currently have been debating the need, real or imagined, to migrate to Java 5. As developers, we just want to play with something new and shinny but there are business consideration that come into play.

As an exercise I migrated our code to Java 5 and then up to Java 6 and ran into few compilation and runtime errors. Upgrading to Java 5 revealed compilation errors with XPathAPI. To fix the XPathAPI error I just needed to add xalan as a dependency or import com.sun.org.apache.xpath.internal.XPathAPI. I also had a compilation error because it seems that compareTo(Object) had been removed form BigDecimal and BigInteger. As you know, Java 5 introduced enum as a keyword and wouldn’t you know I got a ton of warnings about this but this can easily be refactored.

Our system had a few runtime problems when moving to Java 5. We have some objects serialized to disk and changing the version of Java throws an InvalidClassException when reading in these objects. I also encountered some runtime exceptions thrown because of FileLock/FileChannel where none was throw before in Java 1.4.2. The errors where thrown because we had a programming error, we tried to release a file lock after the FileOutputStream for that lock had been closed.

Moving up to Java 6 I encountered a ton of compilation errors because new abstract methods have been introduced into JDBC classes such as Connection, Wrapper, and ResultSet.

Technorati Tags: , , ,