Tuesday, February 07, 2006

What Is "Modern" Java Compilation?

Occasionally in Ant you can see messages like this:
"[javac] Using modern compiler"

What does this mean?

In Ant you have the property " build.compiler" to specify if you want to use a classic or modern compiler. Now what do they mean by modern or classic. Well, they call classic compiler the compilers of JDK 1.1 and 1.2 and they call modern compiler the ones of JDK 1.3+. They made that distinction because a classic compiler does not support the same options as modern compilers: the semantics of javac tool changed in JDK 1.3.

This terminology can easily be confused with java class file compatibility. Java class file compatibility is changed using the "-target" option of javac tool. One can specify in ant to compile with modern compilers and a target 1.4, the result is likely to not run on JVM 1.3. One can specify modern and a target 1.1, the resulting classes will run on JVM 1.1, but ant build.xml file will not be usable with JDK 1.1 without changing modern to classic.

I find Ant choice of word a bit confusing as using a "modern" compiler has little to do with the resulting class files.

No comments :

Post a Comment