git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@275868 13f79535-47bb-0310-9956-ffa450edef68master
@@ -52,9 +52,10 @@ attribute are:</a></p> | |||
<li><code>classic</code> (the standard compiler of JDK 1.1/1.2) – | |||
<code>javac1.1</code> and | |||
<code>javac1.2</code> can be used as aliases.</li> | |||
<li><code>modern</code> (the standard compiler of JDK 1.3/1.4) – | |||
<li><code>modern</code> (the standard compiler of JDK 1.3/1.4/1.5) – | |||
<code>javac1.3</code> and | |||
<code>javac1.4</code> can be used as aliases.</li> | |||
<code>javac1.4</code> and | |||
<code>javac1.5</code> can be used as aliases.</li> | |||
<li><code>jikes</code> (the <a | |||
href="http://oss.software.ibm.com/developerworks/opensource/jikes/" target="_top">Jikes</a> | |||
compiler).</li> | |||
@@ -235,7 +236,7 @@ invoking the compiler.</p> | |||
<td valign="top">Generate class files for specific VM version | |||
(e.g., <code>1.1</code> or <code>1.2</code>). <b>Note that the | |||
default value depends on the JVM that is running Ant. In | |||
particular, if you use JDK 1.4 the generated classes will not be | |||
particular, if you use JDK 1.4+ the generated classes will not be | |||
usable for a 1.1 Java VM unless you explicitly set this attribute | |||
to the value 1.1 (which is the default value for JDK 1.1 to | |||
1.3).</b></td> | |||
@@ -310,12 +311,12 @@ invoking the compiler.</p> | |||
<td valign="top">source</td> | |||
<td valign="top">Value of the <code>-source</code> command-line | |||
switch; will be ignored by all implementations except | |||
switch; will be ignored by all implementations prior to | |||
<code>javac1.4</code> (or <code>modern</code> when Ant is not | |||
running in a 1.3 VM) and <code>jikes</code>.<br> If you use this | |||
attribute together with <code>jikes</code>, you must make sure | |||
that your version of jikes supports the <code>-source</code> | |||
switch.<br> Legal values are <code>1.3</code> and <code>1.4</code> | |||
switch.<br> Legal values are <code>1.3</code>, <code>1.4</code> and <code>1.5</code> | |||
– by default, no <code>-source</code> argument will be used | |||
at all.</td> | |||
@@ -594,7 +595,7 @@ while all others are <code>false</code>.</p> | |||
<code><javac></code>.</p> | |||
<hr> | |||
<p align="center">Copyright © 2000-2003 Apache Software Foundation. | |||
<p align="center">Copyright © 2000-2004 Apache Software Foundation. | |||
All rights Reserved.</p> | |||
</body> | |||
@@ -1,7 +1,7 @@ | |||
/* | |||
* The Apache Software License, Version 1.1 | |||
* | |||
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights | |||
* Copyright (c) 2000-2004 The Apache Software Foundation. All rights | |||
* reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without | |||
@@ -155,6 +155,8 @@ public class Javac extends MatchingTask { | |||
facade = new FacadeTaskHelper("javac1.3"); | |||
} else if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_4)) { | |||
facade = new FacadeTaskHelper("javac1.4"); | |||
} else if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_5)) { | |||
facade = new FacadeTaskHelper("javac1.5"); | |||
} else { | |||
facade = new FacadeTaskHelper("classic"); | |||
} | |||
@@ -198,7 +200,7 @@ public class Javac extends MatchingTask { | |||
* | |||
* If you use this attribute together with jikes, you must | |||
* make sure that your version of jikes supports the -source switch. | |||
* Legal values are 1.3 and 1.4 - by default, no -source argument | |||
* Legal values are 1.3, 1.4 and 1.5 - by default, no -source argument | |||
* will be used at all. | |||
* | |||
* @param v Value to assign to source. | |||
@@ -845,7 +847,7 @@ public class Javac extends MatchingTask { | |||
* | |||
* @param compilerImpl the name of the compiler implementation | |||
* @return true if compilerImpl is "modern", "classic", "javac1.1", | |||
* "javac1.2", "javac1.3" or "javac1.4". | |||
* "javac1.2", "javac1.3", "javac1.4" or "javac1.5". | |||
*/ | |||
protected boolean isJdkCompiler(String compilerImpl) { | |||
return "modern".equals(compilerImpl) | |||
@@ -853,7 +855,8 @@ public class Javac extends MatchingTask { | |||
|| "javac1.1".equals(compilerImpl) | |||
|| "javac1.2".equals(compilerImpl) | |||
|| "javac1.3".equals(compilerImpl) | |||
|| "javac1.4".equals(compilerImpl); | |||
|| "javac1.4".equals(compilerImpl) | |||
|| "javac1.5".equals(compilerImpl); | |||
} | |||
/** | |||
@@ -1,7 +1,7 @@ | |||
/* | |||
* The Apache Software License, Version 1.1 | |||
* | |||
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights | |||
* Copyright (c) 2001-2004 The Apache Software Foundation. All rights | |||
* reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without | |||
@@ -80,7 +80,7 @@ public class CompilerAdapterFactory { | |||
* <ul><li>jikes = jikes compiler | |||
* <li>classic, javac1.1, javac1.2 = the standard compiler from JDK | |||
* 1.1/1.2 | |||
* <li>modern, javac1.3, javac1.4 = the compiler of JDK 1.3+ | |||
* <li>modern, javac1.3, javac1.4, javac1.5 = the compiler of JDK 1.3+ | |||
* <li>jvc, microsoft = the command line compiler from Microsoft's SDK | |||
* for Java / Visual J++ | |||
* <li>kjc = the kopi compiler</li> | |||
@@ -100,7 +100,9 @@ public class CompilerAdapterFactory { | |||
throws BuildException { | |||
boolean isClassicCompilerSupported = true; | |||
//as new versions of java come out, add them to this test | |||
if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_4)) { | |||
if (!JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1) | |||
&& !JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_2) | |||
&& !JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_3)) { | |||
isClassicCompilerSupported = false; | |||
} | |||
@@ -127,7 +129,8 @@ public class CompilerAdapterFactory { | |||
//but on java>=1.4 we just bail out early | |||
if (compilerType.equalsIgnoreCase("modern") | |||
|| compilerType.equalsIgnoreCase("javac1.3") | |||
|| compilerType.equalsIgnoreCase("javac1.4")) { | |||
|| compilerType.equalsIgnoreCase("javac1.4") | |||
|| compilerType.equalsIgnoreCase("javac1.5")) { | |||
// does the modern compiler exist? | |||
if (doesModernCompilerExist()) { | |||
return new Javac13(); | |||
@@ -1,7 +1,7 @@ | |||
/* | |||
* The Apache Software License, Version 1.1 | |||
* | |||
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights | |||
* Copyright (c) 2001-2004 The Apache Software Foundation. All rights | |||
* reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without | |||
@@ -1,7 +1,7 @@ | |||
/* | |||
* The Apache Software License, Version 1.1 | |||
* | |||
* Copyright (c) 2002-2003 The Apache Software Foundation. All rights | |||
* Copyright (c) 2002-2004 The Apache Software Foundation. All rights | |||
* reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without | |||
@@ -96,6 +96,8 @@ public class JavaEnvUtils { | |||
public static final String JAVA_1_3 = "1.3"; | |||
/** Version constant for Java 1.4 */ | |||
public static final String JAVA_1_4 = "1.4"; | |||
/** Version constant for Java 1.5 */ | |||
public static final String JAVA_1_5 = "1.5"; | |||
/** array of packages in the runtime */ | |||
private static Vector jrePackages; | |||
@@ -104,6 +106,7 @@ public class JavaEnvUtils { | |||
static { | |||
// Determine the Java version by looking at available classes | |||
// java.lang.Readable was introduced in JDK 1.5 | |||
// java.lang.CharSequence was introduced in JDK 1.4 | |||
// java.lang.StrictMath was introduced in JDK 1.3 | |||
// java.lang.ThreadLocal was introduced in JDK 1.2 | |||
@@ -125,6 +128,9 @@ public class JavaEnvUtils { | |||
Class.forName("java.lang.CharSequence"); | |||
javaVersion = JAVA_1_4; | |||
javaVersionNumber++; | |||
Class.forName("java.lang.Readable"); | |||
javaVersion = JAVA_1_5; | |||
javaVersionNumber++; | |||
} catch (Throwable t) { | |||
// swallow as we've hit the max class version that | |||
// we have | |||
@@ -275,6 +281,7 @@ public class JavaEnvUtils { | |||
private static void buildJrePackages() { | |||
jrePackages = new Vector(); | |||
switch(javaVersionNumber) { | |||
case 15: | |||
case 14: | |||
jrePackages.addElement("org.apache.crimson"); | |||
jrePackages.addElement("org.apache.xalan"); | |||
@@ -317,6 +324,7 @@ public class JavaEnvUtils { | |||
Vector tests = new Vector(); | |||
tests.addElement("java.lang.Object"); | |||
switch(javaVersionNumber) { | |||
case 15: | |||
case 14: | |||
tests.addElement("sun.audio.AudioPlayer"); | |||
tests.addElement("org.apache.crimson.parser.ContentModel"); | |||