@@ -98,13 +98,6 @@ public final class CompilerAdapterFactory {
public static CompilerAdapter getCompiler(String compilerType, Task task,
Path classpath)
throws BuildException {
boolean isClassicCompilerSupported = true;
//as new versions of java come out, add them to this test
if (!JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_2)
&& !JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_3)) {
isClassicCompilerSupported = false;
}
if (compilerType.equalsIgnoreCase("jikes")) {
return new Jikes();
}
@@ -114,15 +107,11 @@ public final class CompilerAdapterFactory {
if (compilerType.equalsIgnoreCase("classic")
|| compilerType.equalsIgnoreCase("javac1.1")
|| compilerType.equalsIgnoreCase("javac1.2")) {
if (isClassicCompilerSupported) {
return new Javac12();
} else {
task.log("This version of java does "
+ "not support the classic "
+ "compiler; upgrading to modern",
Project.MSG_WARN);
compilerType = "modern";
}
task.log("This version of java does "
+ "not support the classic "
+ "compiler; upgrading to modern",
Project.MSG_WARN);
compilerType = "modern";
}
//on java<=1.3 the modern falls back to classic if it is not found
//but on java>=1.4 we just bail out early
@@ -135,22 +124,16 @@ public final class CompilerAdapterFactory {
if (doesModernCompilerExist()) {
return new Javac13();
} else {
if (isClassicCompilerSupported) {
task.log("Modern compiler not found - looking for "
+ "classic compiler", Project.MSG_WARN);
return new Javac12();
} else {
throw new BuildException("Unable to find a javac "
+ "compiler;\n"
+ MODERN_COMPILER
+ " is not on the "
+ "classpath.\n"
+ "Perhaps JAVA_HOME does not"
+ " point to the JDK.\n"
+ "It is currently set to \""
+ JavaEnvUtils.getJavaHome()
+ "\"");
}
throw new BuildException("Unable to find a javac "
+ "compiler;\n"
+ MODERN_COMPILER
+ " is not on the "
+ "classpath.\n"
+ "Perhaps JAVA_HOME does not"
+ " point to the JDK.\n"
+ "It is currently set to \""
+ JavaEnvUtils.getJavaHome()
+ "\"");
}
}