diff --git a/docs/manual/CoreTasks/javac.html b/docs/manual/CoreTasks/javac.html
index 238442816..9387ed6b5 100644
--- a/docs/manual/CoreTasks/javac.html
+++ b/docs/manual/CoreTasks/javac.html
@@ -31,8 +31,10 @@ inclusion/exclusion of files works, and how to write patterns.
It is possible to use different compilers. This can be selected with the
"build.compiler" property. There are four choices:
- - classic (the standard compiler of JDK 1.1/1.2)
- - modern (the new compiler of JDK 1.3)
+ - classic (the standard compiler of JDK 1.1/1.2) - javac1.1 and
+ javac1.2 can be used as aliases
+ - modern (the standard compiler of JDK 1.3/1.4) - javac1.3 and
+ javac1.4 can be used as aliases
- jikes (the Jikes
compiler)
diff --git a/src/main/org/apache/tools/ant/taskdefs/Javac.java b/src/main/org/apache/tools/ant/taskdefs/Javac.java
index b4584729f..af0ac7db9 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Javac.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Javac.java
@@ -450,9 +450,18 @@ public class Javac extends MatchingTask {
if (fork) {
if (compiler != null) {
- log("Since fork is true, ignoring build.compiler setting.", Project.MSG_WARN);
- }
- compiler = "extJavac";
+ if (isJdkCompiler(compiler)) {
+ log("Since fork is true, ignoring build.compiler setting.",
+ Project.MSG_WARN);
+ compiler = "extJavac";
+ }
+ else {
+ log("Since build.compiler setting isn't classic or modern, ignoring fork setting.", Project.MSG_WARN);
+ }
+ }
+ else {
+ compiler = "extJavac";
+ }
}
if (compiler == null) {
@@ -522,4 +531,13 @@ public class Javac extends MatchingTask {
return compileList;
}
+ protected boolean isJdkCompiler(String compiler) {
+ return "modern".equals(compiler) ||
+ "classic".equals(compiler) ||
+ "javac1.1".equals(compiler) ||
+ "javac1.2".equals(compiler) ||
+ "javac1.3".equals(compiler) ||
+ "javac1.4".equals(compiler);
+ }
+
}
diff --git a/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java b/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java
index fc12c088d..560ae25b7 100644
--- a/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java
+++ b/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java
@@ -109,7 +109,8 @@ public class CompilerAdapterFactory {
return new Javac12();
}
if ( compilerType.equalsIgnoreCase("modern") ||
- compilerType.equalsIgnoreCase("javac1.3")) {
+ compilerType.equalsIgnoreCase("javac1.3") ||
+ compilerType.equalsIgnoreCase("javac1.4")) {
// does the modern compiler exist?
try {
Class.forName("com.sun.tools.javac.Main");