Java: Understanding JSR14

Your Ad Here

During the development of the Java generics specification (and other language features added in Java 5), experimental support was added to the javac compiler to allow it to consume Java 5 language features and generate bytecode that could be run on a Java 1.4 JVM. While these features are not supported (or even documented), they are used by a number of open source projects to allow developers to code using Java 5 language features and produce JAR files that can be used on earlier JVMs. And, now that javac is open source, it is possible the features might be supported by a third party. To activate these features, you can invoke javac with the -source 1.5 and -target jsr14 options.

The JSR 14 target mode of javac causes the compiler to emit JDK 1.4-compatible bytecode corresponding to Java 5 language features:

Using the JSR 14 target mode allows you to write code that uses generics, autoboxing, and the for-each loop in the “easy” cases, which may suffice for many projects. It is convenient, if unsupported, and the compiler generates mostly compatible bytecode in a single pass.

Quoted from

http://www.ibm.com/developerworks/java/library/j-jtp02277.html



Trackback URL

Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically to your feed reader.

Comments

No comments yet.

Leave a comment

(required)

(required)