Formatting tweaks to generator/ast/*.java source.

Patch by: tobyr
Review by: bruce


git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@951 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/generator/NameFactory.java b/dev/core/src/com/google/gwt/dev/generator/NameFactory.java
index ac7d2ed..14f8744 100644
--- a/dev/core/src/com/google/gwt/dev/generator/NameFactory.java
+++ b/dev/core/src/com/google/gwt/dev/generator/NameFactory.java
@@ -20,21 +20,21 @@
 import java.util.Collection;
 
 /**
- * Generates unique identifiers. Use this class to avoid generating
+ * Generates unqiue identifiers. Use this class to avoid generating
  * conflicting names with user code. This class isn't smart enough to know
  * about scopes (which isn't generally a problem for generators in any case).
  */
 public class NameFactory {
 
-  private Set usedNames = new HashSet();
+  private final Set usedNames = new HashSet();
 
   /**
-   * Creates a new NameFactory that knows about <code> existingNames</code>.
+   * Creates a new <code>NameFactory</code> that knows about
+   * <code>existingNames</code>.
    *
-   * @param existingNames a Collection of strings, may be null
+   * @param existingNames a list of names that may be <code>null</code>.
    */
   public NameFactory(Collection existingNames) {
-    this.usedNames = new HashSet();
     if (existingNames == null) {
       return;
     }
@@ -42,20 +42,20 @@
   }
 
   /**
-   * Creates a new NameFactory that doesn't know about any existing names.
+   * Creates a new <code>NameFactory</code> that doesn't know about any existing
+   * names.
    */
   public NameFactory() {
     this(null);
   }
 
   /**
-   * Adds a name to the set of already known identifiers.  This implementation
-   * asserts that the identifier is unique.
+   * Adds a name to the set of already known identifiers. Has no affect if the
+   * name is already considered an existing identifier.
    *
-   * @param name a non-null, unique name
+   * @param name a not <code>null</code> name
    */
   public void addName(String name) {
-    assert (!usedNames.contains(name));
     usedNames.add(name);
   }
 
@@ -63,13 +63,11 @@
    * Creates a new unique name based off of <code>name</code> and adds it to
    * the list of known names.
    *
-   * @param name a non-null name to base the new unique name from
-   * @return a new unique, non-null name. This name may be possibly identical
-   *         to <code>name</code>
+   * @param name a not <code>null</code> name to base the new unique name from
+   * @return a new unique, not <code>null</code> name. This name may be possibly
+   * identical to <code>name</code>.
    */
   public String createName(String name) {
-    assert (name != null);
-    
     String newName = name;
 
     for (int count = 0; true; ++count) {
diff --git a/dev/core/src/com/google/gwt/dev/generator/ast/BaseNode.java b/dev/core/src/com/google/gwt/dev/generator/ast/BaseNode.java
index ef26c7c..7c60eda 100644
--- a/dev/core/src/com/google/gwt/dev/generator/ast/BaseNode.java
+++ b/dev/core/src/com/google/gwt/dev/generator/ast/BaseNode.java
@@ -16,7 +16,7 @@
 package com.google.gwt.dev.generator.ast;
 
 /**
- * A simple base class for implementing an AST node.
+ * A simple base class for implementing an AST {@link Node}.
  */
 public abstract class BaseNode implements Node {
 
diff --git a/dev/core/src/com/google/gwt/dev/generator/ast/Expression.java b/dev/core/src/com/google/gwt/dev/generator/ast/Expression.java
index db851ca..9c6be9f 100644
--- a/dev/core/src/com/google/gwt/dev/generator/ast/Expression.java
+++ b/dev/core/src/com/google/gwt/dev/generator/ast/Expression.java
@@ -16,16 +16,16 @@
 package com.google.gwt.dev.generator.ast;
 
 /**
- * A Node that represents a Java expression. An expression is a parsable value
- * that is a subset of a statement. For example,
+ * A {@link Node} that represents a Java expression. An <code>Expression</code>
+ * is a parsable value that is a subset of a {@link Statement}. For example,
  *
  * <ul> <li>foo( a, b )</li> <li>14</li> <li>11 / 3</li> <li>x</li> </ul>
  *
- * are all Expressions.
+ * are all <code>Expressions</code>.
  */
 public class Expression extends BaseNode {
 
-  String code;
+  protected String code;
 
   public Expression() {
     code = "";
diff --git a/dev/core/src/com/google/gwt/dev/generator/ast/ForLoop.java b/dev/core/src/com/google/gwt/dev/generator/ast/ForLoop.java
index c048be4..151dfb6 100644
--- a/dev/core/src/com/google/gwt/dev/generator/ast/ForLoop.java
+++ b/dev/core/src/com/google/gwt/dev/generator/ast/ForLoop.java
@@ -1,12 +1,12 @@
 /*
  * Copyright 2007 Google Inc.
- *
+ * 
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  * use this file except in compliance with the License. You may obtain a copy of
  * the License at
- *
+ * 
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -18,36 +18,36 @@
 import java.util.List;
 
 /**
- * A Node that represents a for loop.
+ * A kind of {@link Statements} that represents a <code>for</code> loop.
  */
 public class ForLoop implements Statements {
 
-  StatementsList body;
+  private final StatementsList body;
 
-  String initializer;
+  private final String initializer;
 
-  String label;
+  private String label;
 
-  String step;
+  private final String step;
 
-  String test;
+  private final String test;
 
   /**
-   * Creates a ForLoop with a null body.
-   *
+   * Creates a {@link ForLoop#ForLoop(String,String,String,Statements)} with a
+   * null body.
    */
   public ForLoop(String initializer, String test, String step) {
     this(initializer, test, step, null);
   }
 
   /**
-   * Constructs a new ForLoop node.
-   *
-   * @param initializer The initializer Expression.
-   * @param test        The test Expression.
-   * @param step        The step Expression. May be null.
-   * @param statements The statements for the body of the loop.
-   * May be null.
+   * Constructs a new <code>ForLoop</code> {@link Node}.
+   * 
+   * @param initializer The textual initializer {@link Expression}.
+   * @param test The textual test {@link Expression}.
+   * @param step The textual step {@link Expression}. May be <code>null</code>.
+   * @param statements The {@link Statements} for the body of the loop. May be
+   *          <code>null</code>.
    */
   public ForLoop(String initializer, String test, String step,
       Statements statements) {
@@ -71,9 +71,7 @@
 
   public String toCode() {
     String loop = "for ( " + initializer + "; " + test + "; " + step + " ) {\n"
-        +
-        body.toCode() + "\n" +
-        "}\n";
+        + body.toCode() + "\n" + "}\n";
 
     return label != null ? label + ": " + loop : loop;
   }
diff --git a/dev/core/src/com/google/gwt/dev/generator/ast/MethodCall.java b/dev/core/src/com/google/gwt/dev/generator/ast/MethodCall.java
index 8b0a2c3..68762cd 100644
--- a/dev/core/src/com/google/gwt/dev/generator/ast/MethodCall.java
+++ b/dev/core/src/com/google/gwt/dev/generator/ast/MethodCall.java
@@ -18,14 +18,14 @@
 import java.util.List;
 
 /**
- * A Node that represents a method call Expression, for example,
- * foo( a, b, c ).
+ * An {@link Expression} that represents a method call, for example,
+ * <code>foo( a, b, c )</code>.
  */
 public class MethodCall extends Expression {
 
-  List arguments;
+  private final List arguments;
 
-  String name;
+  private final String name;
 
   /**
    * Creates a new MethodCall Expression.
diff --git a/dev/core/src/com/google/gwt/dev/generator/ast/Node.java b/dev/core/src/com/google/gwt/dev/generator/ast/Node.java
index b254865..ad9f716 100644
--- a/dev/core/src/com/google/gwt/dev/generator/ast/Node.java
+++ b/dev/core/src/com/google/gwt/dev/generator/ast/Node.java
@@ -16,15 +16,15 @@
 package com.google.gwt.dev.generator.ast;
 
 /**
- * An AST node. Must be able to return it's code representation as a String.
- *
+ * An AST node. Must be able to return it's code representation as a
+ * {@link String}.
  */
 public interface Node {
 
   /**
-   * The Java code representation of this Node.
+   * The Java code representation of this <code>Node</code>.
    *
-   * @return a non-null String.
+   * @return a not <code>null</code> {@link String}.
    */
   public String toCode();
 }
diff --git a/dev/core/src/com/google/gwt/dev/generator/ast/Statement.java b/dev/core/src/com/google/gwt/dev/generator/ast/Statement.java
index 84b2653..779df9d 100644
--- a/dev/core/src/com/google/gwt/dev/generator/ast/Statement.java
+++ b/dev/core/src/com/google/gwt/dev/generator/ast/Statement.java
@@ -19,21 +19,22 @@
 import java.util.Arrays;
 
 /**
- * A Node that represents a single Java statement.
+ * A {@link Node} that represents a single Java statement.
  */
 public class Statement extends BaseNode implements Statements {
 
-  String code;
+  private String code;
 
-  Expression expression;
+  private Expression expression;
 
-  private List list;
+  private final List list;
 
   /**
-   * Creates a new statement from a String of code representing an Expression.
-   * Automatically appends a semicolon to <code>code</code>.
+   * Creates a new <code>Statement</code> from a {@link String} of code
+   * representing an {@link Expression}. Automatically appends a semicolon to
+   * <code>code</code>.
    *
-   * @param code An Expression. Should not end with a semicolon.
+   * @param code A textual {@link Expression}. Should not end with a semicolon.
    */
   public Statement(String code) {
     this.code = code;
@@ -41,9 +42,9 @@
   }
 
   /**
-   * Creates a new statement from an Expression.
+   * Creates a new <code>Statement</code> from an {@link Expression}.
    *
-   * @param expression A non-null Expression.
+   * @param expression A non <code>null</code> {@link Expression}.
    */
   public Statement(Expression expression) {
     this.expression = expression;
@@ -51,8 +52,8 @@
   }
 
   /**
-   * Returns this single Statement as a List of Statements of size, one.
-   *
+   * Returns this single <code>Statement</code> as a {@link java.util.List} of
+   * {@link Statement}s of size, one.
    */
   public List getStatements() {
     return list;
diff --git a/dev/core/src/com/google/gwt/dev/generator/ast/Statements.java b/dev/core/src/com/google/gwt/dev/generator/ast/Statements.java
index e383c8f..b99cba5 100644
--- a/dev/core/src/com/google/gwt/dev/generator/ast/Statements.java
+++ b/dev/core/src/com/google/gwt/dev/generator/ast/Statements.java
@@ -18,15 +18,15 @@
 import java.util.List;
 
 /**
- * Represents one or more groups of Statements. Can optionally be added to.
- *
+ * Represents one or more groups of {@link Statement}s. Can optionally be
+ * added to.
  */
 public interface Statements extends Node {
 
   /**
-   * Returns a list of Statements.
+   * Returns a list of {@link Statement}s.
    *
-   * @return a non-null list of Statements.
+   * @return a non <code>null</code> list of {@link Statement}s.
    */
   public List getStatements();
 }
diff --git a/dev/core/src/com/google/gwt/dev/generator/ast/StatementsList.java b/dev/core/src/com/google/gwt/dev/generator/ast/StatementsList.java
index dbbf0b9..e023e78 100644
--- a/dev/core/src/com/google/gwt/dev/generator/ast/StatementsList.java
+++ b/dev/core/src/com/google/gwt/dev/generator/ast/StatementsList.java
@@ -20,24 +20,21 @@
 import java.util.Iterator;
 
 /**
- * An implementation of <code>Statements</code> that is composed of a list of
- * <code>Statements</code>.
+ * An implementation of {@link Statements} that is composed of a list of
+ * {@link Statement}s.
  */
 public class StatementsList extends BaseNode implements Statements {
 
-  List/*<Statements>*/ statements;
+  private final List/*<Statements>*/ statements = new ArrayList();
 
   /**
-   * Creates a new StatementsList with no Statements.
-   *
+   * Creates a new <code>StatementsList</code> with no {@link Statements}.
    */
   public StatementsList() {
-    statements = new ArrayList();
   }
 
   /**
-   * Returns the Statements that are in this list.
-   *
+   * Returns the {@link Statements} that are in this list.
    */
   public List getStatements() {
     return statements;
diff --git a/dev/core/src/com/google/gwt/dev/generator/ast/WhileLoop.java b/dev/core/src/com/google/gwt/dev/generator/ast/WhileLoop.java
index d1e34ff..755bb57 100644
--- a/dev/core/src/com/google/gwt/dev/generator/ast/WhileLoop.java
+++ b/dev/core/src/com/google/gwt/dev/generator/ast/WhileLoop.java
@@ -18,23 +18,23 @@
 import java.util.List;
 
 /**
- * A Node that represents a Java while loop.
+ * A Node that represents a Java <code>while</code> loop.
  */
 public class WhileLoop implements Statements {
 
-  StatementsList body;
+  private final StatementsList body = new StatementsList();
 
-  String test;
+  private final String test;
 
   /**
-   * Creates a new while loop with <code>test</code> as the test Expression.
-   * The WhileLoop has an empty body.
+   * Creates a new <code>while</code> loop with <code>test</code> as the test
+   * {@link Expression}. The <code>WhileLoop</code> has an empty body.
    *
-   * @param test An Expression that must be of type boolean. Must be non-null.
+   * @param test A textual <code>boolean</code> {@link Expression}. Must not be
+   * <code>null</code>.
    */
   public WhileLoop(String test) {
     this.test = test;
-    this.body = new StatementsList();
   }
 
   public List getStatements() {