- Using Java 5 language features in earlier JDK
Java 5 added a number of powerful language features: generics, enumerations, annotations, autoboxing, and the enhanced for loop. However, many shops are still tied to JDK 1.4 or earlier and may be for some time to come. But it's still be possible for those developers to take advantage of these powerful language features while continuing to deploy on earlier JVMs. Brian Goetz returns from his hiatus in this installment of Java theory and practice to demonstrate how.
With Java 6.0 being newly released, you might think the Java 5 language features are "old news." But even now, when I ask developers which version of the Java platform they are using in development, typically only half are using Java 5 -- and the other half are jealous. They are eager to use the language features added in Java 5 such as generics and annotations, but a number of factors still prevent many from doing so.
One category of developers unable to take advantage of Java 5 features are those who develop components, libraries, or application frameworks. Because their customers may still be using JDK 1.4 or earlier and classes compiled with Java 5 cannot be loaded by JDK 1.4 or previous JVMs, using Java 5 language features would limit their customer base to companies that have already transitioned to Java 5.
Another group of developers often held back from using Java 5 are those working with Java EE. Many shops will not use Java 5 with Java EE 1.4 or earlier for fear that it will not be supported by their application server vendor. But it may be a while before those shops transition to Java EE 5. In addition to the lag time between the Java EE 5 and Java SE 5 specifications, commercial Java EE 5 containers are not necessarily available as soon as the ink is dry on the specification, businesses do not necessarily upgrade their applications servers as soon as the next version is available, and even after upgrading their application server, it may take some time to certify their applications on the new platform.
Java 5 language feature implementation
- 下一篇：J2EE Architectures