Sort, format, misc tweaks.

Review by: spoon@google.com

git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@7700 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/jjs/ast/JGwtCreate.java b/dev/core/src/com/google/gwt/dev/jjs/ast/JGwtCreate.java
index 4784772..1c867e2 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/ast/JGwtCreate.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/ast/JGwtCreate.java
@@ -64,7 +64,6 @@
 
   private final ArrayList<JExpression> instantiationExpressions;
   private final List<JClassType> resultTypes;
-
   private final JReferenceType sourceType;
 
   /*
diff --git a/dev/core/src/com/google/gwt/dev/jjs/ast/JMethod.java b/dev/core/src/com/google/gwt/dev/jjs/ast/JMethod.java
index 644bbaa..a28357c 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/ast/JMethod.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/ast/JMethod.java
@@ -43,12 +43,12 @@
     System.out.println(code);
   }
 
+  private List<JAnnotation> annotations = Lists.create();
+
   /**
    * Special serialization treatment.
    */
   private transient JAbstractMethodBody body = null;
-
-  private List<JAnnotation> annotations = Lists.create();
   private final JDeclaredType enclosingType;
   private final boolean isAbstract;
   private boolean isFinal;
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/CastNormalizer.java b/dev/core/src/com/google/gwt/dev/jjs/impl/CastNormalizer.java
index dc0a041..acb8525 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/CastNormalizer.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/CastNormalizer.java
@@ -176,7 +176,6 @@
         JTypeOracle typeOracle = program.typeOracle;
         JType rhsType = x.getRhs().getType();
         assert (rhsType instanceof JReferenceType);
-        JReferenceType refRhsType = (JReferenceType) rhsType;
 
         for (JArrayType arrayType : instantiatedArrayTypes) {
           if (typeOracle.canTheoreticallyCast(arrayType, lhsArrayType)) {
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/DeadCodeElimination.java b/dev/core/src/com/google/gwt/dev/jjs/impl/DeadCodeElimination.java
index 7e4381c..45b757c 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/DeadCodeElimination.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/DeadCodeElimination.java
@@ -84,8 +84,8 @@
    * operations in favor of pure side effects.
    * 
    * TODO(spoon): move more simplifications into methods like
-   * {@link #cast(JExpression, SourceInfo, JType, JExpression) simplifyCast},
-   * so that more simplifications can be made on a single pass through a tree.
+   * {@link #cast(JExpression, SourceInfo, JType, JExpression) simplifyCast}, so
+   * that more simplifications can be made on a single pass through a tree.
    */
   public class DeadCodeVisitor extends JModVisitor {
 
@@ -94,8 +94,8 @@
     /**
      * Expressions whose result does not matter. A parent node should add any
      * children whose result does not matter to this set during the parent's
-     * <code>visit()</code> method. It should then remove those children
-     * during its own <code>endVisit()</code>.
+     * <code>visit()</code> method. It should then remove those children during
+     * its own <code>endVisit()</code>.
      * 
      * TODO: there's a latent bug here: some immutable nodes (such as literals)
      * can be multiply referenced in the AST. In theory, one reference to that
@@ -1346,23 +1346,23 @@
     }
 
     /**
-     * Simplify <code>exp == bool</code>, where <code>bool</code> is a
-     * boolean literal.
+     * Simplify <code>exp == bool</code>, where <code>bool</code> is a boolean
+     * literal.
      */
     private void simplifyBooleanEq(JExpression exp, boolean bool, Context ctx) {
       if (bool) {
         ctx.replaceMe(exp);
       } else {
-        ctx.replaceMe(new JPrefixOperation(exp.getSourceInfo(), JUnaryOperator.NOT,
-            exp));
+        ctx.replaceMe(new JPrefixOperation(exp.getSourceInfo(),
+            JUnaryOperator.NOT, exp));
       }
     }
 
     /**
      * Simplify <code>lhs == rhs</code>, where <code>lhs</code> and
      * <code>rhs</code> are known to be boolean. If <code>negate</code> is
-     * <code>true</code>, then treat it as <code>lhs != rhs</code> instead
-     * of <code>lhs == rhs</code>. Assumes that the case where both sides are
+     * <code>true</code>, then treat it as <code>lhs != rhs</code> instead of
+     * <code>lhs == rhs</code>. Assumes that the case where both sides are
      * literals has already been checked.
      */
     private void simplifyBooleanEq(JExpression lhs, JExpression rhs,
@@ -1394,8 +1394,8 @@
     }
 
     /**
-     * Simplify <code>lhs == rhs</code>. If <code>negate</code> is true,
-     * then it's actually static evaluation of <code>lhs != rhs</code>.
+     * Simplify <code>lhs == rhs</code>. If <code>negate</code> is true, then
+     * it's actually static evaluation of <code>lhs != rhs</code>.
      */
     private void simplifyEq(JExpression lhs, JExpression rhs, Context ctx,
         boolean negated) {
@@ -1459,8 +1459,7 @@
       if (original != null) {
         return original;
       }
-      return new JPrefixOperation(exp.getSourceInfo(), JUnaryOperator.NEG,
-          exp);
+      return new JPrefixOperation(exp.getSourceInfo(), JUnaryOperator.NEG, exp);
     }
 
     private boolean simplifySub(JExpression lhs, JExpression rhs, Context ctx,
@@ -1478,8 +1477,8 @@
 
     private void simplifyXor(JExpression lhs, JBooleanLiteral rhs, Context ctx) {
       if (rhs.getValue()) {
-        ctx.replaceMe(new JPrefixOperation(lhs.getSourceInfo(), JUnaryOperator.NOT,
-            lhs));
+        ctx.replaceMe(new JPrefixOperation(lhs.getSourceInfo(),
+            JUnaryOperator.NOT, lhs));
       } else {
         ctx.replaceMe(lhs);
       }
@@ -1587,6 +1586,7 @@
       if (method.getName().endsWith("hashCode")) {
         // This cannot be computed at compile time because our implementation
         // differs from the JRE.
+        // TODO: actually, I think it DOES match now, so we can remove this?
         return;
       }
 
@@ -1683,9 +1683,9 @@
 
         if (caseStatement.getExpr() != null) {
           // Create an if statement equivalent to the single-case switch.
-          JBinaryOperation compareOperation = new JBinaryOperation(x.getSourceInfo(),
-              program.getTypePrimitiveBoolean(), JBinaryOperator.EQ,
-              x.getExpr(), caseStatement.getExpr());
+          JBinaryOperation compareOperation = new JBinaryOperation(
+              x.getSourceInfo(), program.getTypePrimitiveBoolean(),
+              JBinaryOperator.EQ, x.getExpr(), caseStatement.getExpr());
           JBlock block = new JBlock(x.getSourceInfo());
           block.addStmt(statement);
           JIfStatement ifStatement = new JIfStatement(x.getSourceInfo(),
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaAST.java b/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaAST.java
index f217c96..901950c 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaAST.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaAST.java
@@ -2496,7 +2496,6 @@
       return variable;
     }
 
-    @SuppressWarnings("unchecked")
     private void processAnnotationProperties(SourceInfo sourceInfo,
         JAnnotation annotation, ElementValuePair[] elementValuePairs) {
       if (elementValuePairs == null) {
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/Pruner.java b/dev/core/src/com/google/gwt/dev/jjs/impl/Pruner.java
index a6fb2b4..74ab3c2 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/Pruner.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/Pruner.java
@@ -142,25 +142,6 @@
     }
 
     @Override
-    public void endVisit(JNameOf x, Context ctx) {
-      HasName node = x.getNode();
-      boolean pruned;
-      if (node instanceof JField) {
-        pruned = isPruned((JField) node);
-      } else if (node instanceof JMethod) {
-        pruned = isPruned((JMethod) node);
-      } else if (node instanceof JReferenceType) {
-        pruned = !program.typeOracle.isInstantiatedType((JReferenceType) node);
-      } else {
-        throw new InternalCompilerException("Unhandled JNameOf node: " + node);
-      }
-
-      if (pruned) {
-        ctx.replaceMe(program.getLiteralNull());
-      }
-    }
-
-    @Override
     public void endVisit(JMethod x, Context ctx) {
       JType type = x.getType();
       if (type instanceof JReferenceType) {
@@ -227,6 +208,25 @@
     }
 
     @Override
+    public void endVisit(JNameOf x, Context ctx) {
+      HasName node = x.getNode();
+      boolean pruned;
+      if (node instanceof JField) {
+        pruned = isPruned((JField) node);
+      } else if (node instanceof JMethod) {
+        pruned = isPruned((JMethod) node);
+      } else if (node instanceof JReferenceType) {
+        pruned = !program.typeOracle.isInstantiatedType((JReferenceType) node);
+      } else {
+        throw new InternalCompilerException("Unhandled JNameOf node: " + node);
+      }
+
+      if (pruned) {
+        ctx.replaceMe(program.getLiteralNull());
+      }
+    }
+
+    @Override
     public void endVisit(JsniFieldRef x, Context ctx) {
       if (isPruned(x.getField())) {
         String ident = x.getIdent();
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/TypeTightener.java b/dev/core/src/com/google/gwt/dev/jjs/impl/TypeTightener.java
index 2a9edbc..ab7ea02 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/TypeTightener.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/TypeTightener.java
@@ -369,8 +369,8 @@
   public class TightenTypesVisitor extends JModVisitor {
 
     /**
-     * <code>true</code> if this visitor has changed the AST apart from calls
-     * to Context.
+     * <code>true</code> if this visitor has changed the AST apart from calls to
+     * Context.
      */
     private boolean myDidChange = false;
 
@@ -391,7 +391,7 @@
       if (toType == null) {
         toType = (JReferenceType) x.getCastType();
       }
-      JReferenceType fromType = getSingleConcreteType(argType); 
+      JReferenceType fromType = getSingleConcreteType(argType);
       if (fromType == null) {
         fromType = (JReferenceType) argType;
       }
@@ -475,7 +475,7 @@
       if (toType == null) {
         toType = x.getTestType();
       }
-      JReferenceType fromType = getSingleConcreteType(argType); 
+      JReferenceType fromType = getSingleConcreteType(argType);
       if (fromType == null) {
         fromType = (JReferenceType) argType;
       }