bodewig     2004/02/02 06:33:09

  Modified:    docs/manual/CoreTasks java.html
               docs/manual/CoreTypes assertions.html
               docs/manual/OptionalTasks junit.html
  Log:
  Improve docs on assertions.
  
  PR: 25654
  Submitted by: Jesse Glick <jglick at netbeans dot org>
  
  Revision  Changes    Path
  1.27      +9 -1      ant/docs/manual/CoreTasks/java.html
  
  Index: java.html
  ===================================================================
  RCS file: /home/cvs/ant/docs/manual/CoreTasks/java.html,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- java.html 8 Dec 2003 02:27:14 -0000       1.26
  +++ java.html 2 Feb 2004 14:33:08 -0000       1.27
  @@ -235,6 +235,14 @@
   
   <p><em>since Ant 1.6</em>.</p>
   
  +<h4>assertions</h4>
  +
  +<p>You can control enablement of Java 1.4 assertions with an
  +<a href="../CoreTypes/assertions.html"><tt>&lt;assertions&gt;</tt></a>
  +subelement.</p>
  + 
  +<p><em>since Ant 1.6.</em></p>
  +
   <h3>Errors and return codes</h3>
   By default the return code of a &lt;java&gt; is ignored. Alternatively, you 
can set <code>resultproperty</code> to the name
   of a property and have it assigned to the result code (barring immutability,
  @@ -283,7 +291,7 @@
   JVM, as it takes different parameters for other JVMs,
   That JVM can be started from &lt;exec&gt; if required.
   <hr>
  -<p align="center">Copyright &copy; 2000-2003 Apache Software Foundation. All 
rights
  +<p align="center">Copyright &copy; 2000-2004 Apache Software Foundation. All 
rights
   Reserved.</p>
   
   </body>
  
  
  
  1.3       +49 -39    ant/docs/manual/CoreTypes/assertions.html
  
  Index: assertions.html
  ===================================================================
  RCS file: /home/cvs/ant/docs/manual/CoreTypes/assertions.html,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- assertions.html   22 Aug 2003 09:20:12 -0000      1.2
  +++ assertions.html   2 Feb 2004 14:33:08 -0000       1.3
  @@ -9,30 +9,30 @@
   
   <h2><a name="assertions">Assertions</a></h2>
   <p>
  -The assertion type enables or disables the Java1.4 assertion feature, 
  -on a whole java program, or components of a program. It can be used
  -in &lt;java&gt; and &lt;junit&gt; to add extra validation to code.   
  +The <tt>assertions</tt> type enables or disables the Java 1.4 assertions 
feature,
  +on a whole Java program, or components of a program. It can be used
  +in <a href="../CoreTasks/java.html">&lt;java&gt;</a> and
  +<a href="../OptionalTasks/junit.html">&lt;junit&gt;</a> to add extra 
validation to code.  
   
   <p>
   Assertions are covered in the 
  -<a href="http://java.sun.com/j2se/1.4.2/docs/guide/lang/assert.html";>
  -Java 1.4.2</a> documentation, and the 
  -<a href="http://java.sun.com/docs/books/jls/assert-spec.html";>
  -Java Language Specification</a>
  +<a href="http://java.sun.com/j2se/1.4.2/docs/guide/lang/assert.html";>J2SDK 
1.4 documentation</a>,
  +and the
  +<a href="http://java.sun.com/docs/books/jls/assert-spec.html";>Java Language 
Specification</a>.
   
   <p>
  -The key points to note are that a <tt>java.lang.AssertionError</tt> error
  +The key points to note are that a <tt>java.lang.AssertionError</tt>
   is thrown when an assertion fails, and that the facility is only available 
  -on Java1.4 and later. To enable assertions one must set 
<tt>source="1.4"</tt>,
  - "1.5" or later in &lt;javac&gt; when the source is being compiled, and
  +on Java 1.4 and later. To enable assertions one must set 
<tt>source="1.4"</tt>
  +(or later) in <tt>&lt;javac&gt;</tt> when the source is being compiled, and
   that the code must contain <tt>assert</tt> statements to be tested. The
   result of such an action is code that neither compiles or runs on earlier
   versions of Java. For this reason Ant itself currently contains no 
assertions.
   <p>
   
   When assertions are enabled (or disabled) in a task through nested 
  -assertions elements, the classloader or command line is modified with the 
  -appopriate options. This means that the JVM executed must be a Java1.4
  +assertions elements, the class loader or command line is modified with the 
  +appropriate options. This means that the JVM executed must be a Java 1.4
   or later JVM, even if there are no assertions in the code. Attempting to
   enable assertions on earlier VMs will result in an "Unrecognized option" 
   error and the JVM will not start.  
  @@ -52,23 +52,23 @@
     <tr>
       <td valign="top">enableSystemAssertions</td>
       <td valign="top">Flag to turn system assertions on or off.</td>
  -    <td valign="top" align="center">No, default is 'unspecified'</td>
  +    <td valign="top" align="center">No; default is "unspecified"</td>
     </tr>
   </table>
   <p>
  -When the System assertions have neither been enabled or disabled, then 
  -the JVM is not given any assertion information -the default action of the
  +When system assertions have been neither enabled nor disabled, then
  +the JVM is not given any assertion information - the default action of the
    current JVMs is to disable system assertions. 
   <p>
   Note also that there is no apparent documentation for what parts of the
  -system have built in assertions. 
  +JRE come with useful assertions.
   
   <h3>Nested elements</h3>
   
   <h4>enable</h4>
   <p>
   Enable assertions in portions of code.
  -
  +If neither a package nor class is specified, assertions are turned on in 
<i>all</i> (user) code.
   </p>
   <table border="1" cellpadding="2" cellspacing="0">
     <tr>
  @@ -78,14 +78,14 @@
     </tr>
     <tr>
       <td valign="top">class</td>
  -    <td valign="top">The name of a class to enable assertions on.</td>
  +    <td valign="top">The name of a class on which to enable assertions.</td>
       <td valign="top" align="center">No</td>
     </tr>
     <tr>
       <td valign="top">package</td>
       <td valign="top">
  -    The name of a package to turn assertions on. Use "..." for 
  -    the anonymous package.
  +    The name of a package in which to enable assertions on all classes. 
(Includes subpackages.)
  +    Use "<tt>...</tt>" for the anonymous package.
       </td>
       <td valign="top" align="center">No</td>
     </tr>
  @@ -104,14 +104,14 @@
     </tr>
     <tr>
       <td valign="top">class</td>
  -    <td valign="top">The name of a class to disable assertions for.</td>
  +    <td valign="top">The name of a class on which to disable assertions.</td>
       <td valign="top" align="center">No</td>
     </tr>
     <tr>
       <td valign="top">package</td>
       <td valign="top">
  -    The name of a package to turn assertions off on. Use "..." for 
  -    the anonymous package.
  +    The name of a package in which to disable assertions on all classes. 
(Includes subpackages.)
  +    Use "<tt>...</tt>" for the anonymous package.
       </td>
       <td valign="top" align="center">No</td>
     </tr>
  @@ -124,32 +124,42 @@
   
   <h4>Examples</h4>
   
  +<h5>Example: enable assertions in all user classes</h5>
  +
  +All classes not in the JRE (i.e. all non-system classes) will have 
assertions turned on.
  +<pre>
  +&lt;assertions&gt;
  +  &lt;enable/&gt;
  +&lt;/assertions&gt;
  +</pre>
  +
   <h5>Example: enable a single class</h5>
   
   Enable assertions in a class called Test
   <pre>
  -&lt;assertions &gt;
  -  &lt;enable class="Test" /&gt;
  +&lt;assertions&gt;
  +  &lt;enable class="Test"/&gt;
   &lt;/assertions&gt;
   </pre>
   
   <h5>Example: enable a package</h5>
   
  -Enable assertions in a all packages below org.apache
  +Enable assertions in the <tt>org.apache</tt> package
  +and all packages starting with the <tt>org.apache.</tt> prefix
   <pre>
  -&lt;assertions &gt;
  -  &lt;enable package="org.apache" /&gt;
  +&lt;assertions&gt;
  +  &lt;enable package="org.apache"/&gt;
   &lt;/assertions&gt;
   </pre>
   
   <h5>Example: System assertions</h5>
   
  -Example: set system assertions and all org.apache packages except
  -for ant, and the class org.apache.tools.ant.Main.
  +Example: enable system assertions and assertions in all <tt>org.apache</tt> 
packages except
  +for Ant (but including <tt>org.apache.tools.ant.Main</tt>)
   <pre>
  -&lt;assertions enableSystemAssertions="true" &gt;
  -  &lt;enable package="org.apache" /&gt;
  -  &lt;disable package="org.apache.ant" /&gt;
  +&lt;assertions enableSystemAssertions="true"&gt;
  +  &lt;enable package="org.apache"/&gt;
  +  &lt;disable package="org.apache.tools.ant"/&gt;
     &lt;enable class="org.apache.tools.ant.Main"/&gt;
   &lt;/assertions&gt;
   </pre>
  @@ -158,8 +168,8 @@
   
   Disable system assertions; enable those in the anonymous package
   <pre>
  -&lt;assertions enableSystemAssertions="false" &gt;
  -  &lt;enable package="..." /&gt;
  +&lt;assertions enableSystemAssertions="false"&gt;
  +  &lt;enable package="..."/&gt;
   &lt;/assertions&gt;
   </pre>
   
  @@ -169,15 +179,15 @@
   This type is a datatype, so you can declare assertions and use them later
   
   <pre>
  -&lt;assertions id="project.assertions" &gt;
  -  &lt;enable project="org.apache.test" /&gt;
  +&lt;assertions id="project.assertions"&gt;
  +  &lt;enable package="org.apache.test"/&gt;
   &lt;/assertions&gt;
   
  -&lt;assertions refid="project.assertions" /&gt;
  +&lt;assertions refid="project.assertions"/&gt;
   </pre>
   
   <hr>
  -<p align="center">Copyright &copy; 2003 Apache Software Foundation. All 
rights
  +<p align="center">Copyright &copy; 2003-2004 Apache Software Foundation. All 
rights
   Reserved.</p>
   </body>
   </html>
  
  
  
  1.31      +9 -1      ant/docs/manual/OptionalTasks/junit.html
  
  Index: junit.html
  ===================================================================
  RCS file: /home/cvs/ant/docs/manual/OptionalTasks/junit.html,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- junit.html        10 Sep 2003 10:00:14 -0000      1.30
  +++ junit.html        2 Feb 2004 14:33:08 -0000       1.31
  @@ -253,6 +253,14 @@
   
   <p><em>since Ant 1.6</em>.</p>
    
  +<h4>assertions</h4>
  +
  +<p>You can control enablement of Java 1.4 assertions with an
  +<a href="../CoreTypes/assertions.html"><tt>&lt;assertions&gt;</tt></a>
  +subelement.</p>
  + 
  +<p><em>since Ant 1.6.</em></p>
  +
   <h4>formatter</h4>
   
   <p>The results of the tests can be printed in different
  @@ -527,7 +535,7 @@
   <code>${reports.tests}</code>.</p>
   
   <hr>
  -<p align="center">Copyright &copy; 2000-2003 Apache Software Foundation. All 
rights
  +<p align="center">Copyright &copy; 2000-2004 Apache Software Foundation. All 
rights
   Reserved.</p>
   </body>
   </html>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to