From c84ce0470e798a03860bdfd47708d5226e46d93d Mon Sep 17 00:00:00 2001 From: "Jesse N. Glick" Date: Fri, 10 Dec 2004 23:16:08 +0000 Subject: [PATCH] The manual strongly encourages you to specify source/target levels, yet it gave no examples that did so! Putting in some usages to plant the bug in people's minds. (Especially important for people just starting to use JDK 1.5, which changed the default source level.) git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277171 13f79535-47bb-0310-9956-ffa450edef68 --- docs/manual/CoreTasks/javac.html | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/docs/manual/CoreTasks/javac.html b/docs/manual/CoreTasks/javac.html index 5fff13770..17b2838c6 100644 --- a/docs/manual/CoreTasks/javac.html +++ b/docs/manual/CoreTasks/javac.html @@ -416,31 +416,39 @@ used.

destdir="${build}" classpath="xyz.jar" debug="on" + source="1.4" />

compiles all .java files under the ${src} directory, and stores the .class files in the ${build} directory. The classpath used includes xyz.jar, and compiling with -debug information is on.

+debug information is on. The source level is 1.4, +so you can use assert statements.

  <javac srcdir="${src}"
          destdir="${build}"
          fork="true"
+         source="1.2"
+         target="1.2"
   />

compiles all .java files under the ${src} directory, and stores the .class files in the ${build} directory. This will fork off the javac -compiler using the default javac executable.

+compiler using the default javac executable. +The source level is 1.2 (similar to 1.1 or 1.3) and +the class files should be runnable under JDK 1.2+ as well.

  <javac srcdir="${src}"
          destdir="${build}"
          fork="java$$javac.exe"
+         source="1.5"
   />

compiles all .java files under the ${src} directory, and stores the .class files in the ${build} directory. This will fork off the javac compiler, using the executable named java$javac.exe. Note -that the $ sign needs to be escaped by a second one.

+that the $ sign needs to be escaped by a second one. +The source level is 1.5, so you can use generics.

  <javac srcdir="${src}"
          destdir="${build}"
@@ -455,7 +463,9 @@ directory, and stores the
 The classpath used includes xyz.jar, and debug information is on.
 Only files under mypackage/p1 and mypackage/p2 are
 used. All files in and below the mypackage/p1/testpackage
-directory are excluded from compilation.

+directory are excluded from compilation. +You didn't specify a source or target level, +so the actual values used will depend on which JDK you ran Ant with.

  <javac srcdir="${src}:${src2}"
          destdir="${build}"