Minor nits to prepare for the JsType Array implementation.

Change-Id: I379ab0e91b2b63a8c0e785ffcf512b794647db25
diff --git a/dev/core/src/com/google/gwt/dev/jjs/ast/JNewArray.java b/dev/core/src/com/google/gwt/dev/jjs/ast/JNewArray.java
index da6e878..1bc3877 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/ast/JNewArray.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/ast/JNewArray.java
@@ -24,14 +24,15 @@
  */
 public class JNewArray extends JExpression {
 
-  public static JNewArray createDims(
-      SourceInfo info, JArrayType arrayType, List<JExpression> dims) {
-    assert dims != null;
-    return new JNewArray(info, arrayType, dims, null,
+  public static JNewArray createArrayWithDimensionExpressions(
+      SourceInfo info, JArrayType arrayType, List<JExpression> dimensionExpressions) {
+    // Produce all class literals that will eventually get generated.
+    assert dimensionExpressions != null;
+    return new JNewArray(info, arrayType, dimensionExpressions, null,
         new JClassLiteral(info.makeChild(), arrayType.getLeafType()));
   }
 
-  public static JNewArray createInitializers(SourceInfo info, JArrayType arrayType,
+  public static JNewArray createArrayWithInitializers(SourceInfo info, JArrayType arrayType,
       List<JExpression> initializers) {
     assert initializers != null;
     return new JNewArray(info, arrayType, null, initializers,
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/GwtAstBuilder.java b/dev/core/src/com/google/gwt/dev/jjs/impl/GwtAstBuilder.java
index 54cf529..9d2e174 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/GwtAstBuilder.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/GwtAstBuilder.java
@@ -403,7 +403,7 @@
           // handled by ArrayInitializer.
         } else {
           List<JExpression> dims = pop(x.dimensions);
-          push(JNewArray.createDims(info, type, dims));
+          push(JNewArray.createArrayWithDimensionExpressions(info, type, dims));
         }
       } catch (Throwable e) {
         throw translateException(x, e);
@@ -416,7 +416,7 @@
         SourceInfo info = makeSourceInfo(x);
         JArrayType type = (JArrayType) typeMap.get(x.resolvedType);
         List<JExpression> expressions = pop(x.expressions);
-        push(JNewArray.createInitializers(info, type, expressions));
+        push(JNewArray.createArrayWithInitializers(info, type, expressions));
       } catch (Throwable e) {
         throw translateException(x, e);
       }
@@ -1112,7 +1112,8 @@
           JParameter dimParam = synthMethod.getParams().get(0);
           JExpression dimArgExpr = new JParameterRef(dimParam.getSourceInfo(), dimParam);
           dims.add(dimArgExpr);
-          JNewArray newArray = JNewArray.createDims(synthMethod.getSourceInfo(), arrayType, dims);
+          JNewArray newArray = JNewArray.createArrayWithDimensionExpressions(
+              synthMethod.getSourceInfo(), arrayType, dims);
           body.getBlock().addStmt(newArray.makeReturnStatement());
           synthMethod.setBody(body);
         }
@@ -1473,15 +1474,15 @@
       }
       innerLambdaClass.setSuperClass(javaLangObject);
 
-      createSyntheticMethod(info, CLINIT_METHOD_NAME, innerLambdaClass, JPrimitiveType.VOID, false, true,
-          true, AccessModifier.PRIVATE);
+      createSyntheticMethod(info, CLINIT_METHOD_NAME, innerLambdaClass, JPrimitiveType.VOID, false,
+          true, true, AccessModifier.PRIVATE);
 
-      createSyntheticMethod(info, INIT_NAME_METHOD_NAME, innerLambdaClass, JPrimitiveType.VOID, false, false,
-          true, AccessModifier.PRIVATE);
+      createSyntheticMethod(info, INIT_NAME_METHOD_NAME, innerLambdaClass, JPrimitiveType.VOID,
+          false, false, true, AccessModifier.PRIVATE);
 
       // Add a getClass() implementation for all non-Object classes.
-      createSyntheticMethod(info, GwtAstBuilder.GET_CLASS_METHOD_NAME, innerLambdaClass, javaLangClass,
-          false, false, false, AccessModifier.PUBLIC,
+      createSyntheticMethod(info, GwtAstBuilder.GET_CLASS_METHOD_NAME, innerLambdaClass,
+          javaLangClass, false, false, false, AccessModifier.PUBLIC,
           new JClassLiteral(info, innerLambdaClass).makeReturnStatement());
 
       innerLambdaClass.setClassDisposition(JDeclaredType.NestedClassDisposition.LAMBDA);
@@ -1805,7 +1806,8 @@
           instance = new JFieldRef(info,
               new JThisRef(info, innerLambdaClass), outerField, innerLambdaClass);
         } else if (referredMethod instanceof JConstructor) {
-          // the method we are invoking is a constructor and may need enclosing instances passed to it
+          // the method we are invoking is a constructor and may need enclosing instances passed to
+          // it.
           // For example, an class Foo { class Inner { Inner(int x) { } } } needs
           // it's constructor invoked with an enclosing instance, Inner::new
           // Java8 doesn't allow the qualifified case, e.g. x.new Foo() -> x.Foo::new
@@ -1909,7 +1911,7 @@
           JArrayType lastParamType =
               (JArrayType) typeMap.get(x.binding.parameters[x.binding.parameters.length - 1]);
           JNewArray newArray =
-              JNewArray.createInitializers(info, lastParamType, varArgInitializers);
+              JNewArray.createArrayWithInitializers(info, lastParamType, varArgInitializers);
           samCall.addArg(newArray);
         }
 
@@ -2814,7 +2816,8 @@
         JFieldRef fieldRef = new JFieldRef(info, null, field, type);
         initializers.add(fieldRef);
       }
-      JNewArray valuesArrayCopy = JNewArray.createInitializers(info, enumArrayType, initializers);
+      JNewArray valuesArrayCopy =
+          JNewArray.createArrayWithInitializers(info, enumArrayType, initializers);
       if (type.getEnumList().size() > MAX_INLINEABLE_ENUM_SIZE) {
         // Only inline values() if it is small.
         method.setInliningMode(InliningMode.DO_NOT_INLINE);
@@ -3046,7 +3049,7 @@
       List<JExpression> initializers = Lists.newArrayList(tail);
       tail.clear();
       JArrayType lastParamType = (JArrayType) typeMap.get(params[varArg]);
-      JNewArray newArray = JNewArray.createInitializers(info, lastParamType, initializers);
+      JNewArray newArray = JNewArray.createArrayWithInitializers(info, lastParamType, initializers);
       args.add(newArray);
       return args;
     }
@@ -3630,8 +3633,6 @@
 
   /**
    * Manually tracked version count.
-   *
-   * TODO(zundel): something much more awesome?
    */
   private static final long AST_VERSION = 3;
   private static final int MAX_INLINEABLE_ENUM_SIZE = 10;
@@ -3654,8 +3655,9 @@
    */
   private static final Field collectionElementTypeField;
   private static final Field haveReceiverField;
-  private static final Interner<String> stringInterner = StringInterner.get();
+
   private static final TypeBinding[] NO_TYPES = new TypeBinding[0];
+  private static final Interner<String> stringInterner = StringInterner.get();
 
   static {
     InternalCompilerException.preload();
@@ -3761,11 +3763,8 @@
   CudInfo curCud = null;
 
   JClassType javaLangClass = null;
-
   JClassType javaLangObject = null;
-
   JClassType javaLangString = null;
-
   JClassType javaLangThrowable = null;
 
   Map<MethodDeclaration, JsniMethod> jsniMethods;
@@ -3792,7 +3791,8 @@
    *
    * The externalized form will be resolved during AST stitching.
    */
-  static JMethod SAFE_CLOSE_METHOD = JMethod.getExternalizedMethod("com.google.gwt.lang.Exceptions",
+  private static JMethod SAFE_CLOSE_METHOD =
+      JMethod.getExternalizedMethod("com.google.gwt.lang.Exceptions",
       "safeClose(Ljava/lang/AutoCloseable;Ljava/lang/Throwable;)Ljava/lang/Throwable;", true);
 
   private List<JDeclaredType> processImpl() {
@@ -3933,14 +3933,14 @@
 
       if (type instanceof JClassType) {
         assert type.getMethods().size() == INIT_METHOD_INDEX;
-        createSyntheticMethod(info, INIT_NAME_METHOD_NAME, type, JPrimitiveType.VOID, false, false, true,
-            AccessModifier.PRIVATE);
+        createSyntheticMethod(info, INIT_NAME_METHOD_NAME, type, JPrimitiveType.VOID, false, false,
+            true, AccessModifier.PRIVATE);
 
         // Add a getClass() implementation for all non-Object, non-String classes.
         if (isSyntheticGetClassNeeded(x, type)) {
           assert type.getMethods().size() == GET_CLASS_METHOD_INDEX;
-          createSyntheticMethod(info, GET_CLASS_METHOD_NAME, type, javaLangClass, type.isAbstract(), false,
-              false, AccessModifier.PUBLIC);
+          createSyntheticMethod(info, GET_CLASS_METHOD_NAME, type, javaLangClass, type.isAbstract(),
+              false, false, AccessModifier.PUBLIC);
         }
       }
 
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/ToStringGenerationVisitor.java b/dev/core/src/com/google/gwt/dev/jjs/impl/ToStringGenerationVisitor.java
index 5c6027a..453b14e 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/ToStringGenerationVisitor.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/ToStringGenerationVisitor.java
@@ -689,19 +689,18 @@
   @Override
   public boolean visit(JNewArray x, Context ctx) {
     print(CHARS_NEW);
-    printTypeName(x.getArrayType().getLeafType());
-    for (int i = 0; i < x.getArrayType().getDims(); ++i) {
-      print('[');
-      if (x.getDimensionExpressions() != null && x.getDimensionExpressions().size() > i) {
-        accept(x.getDimensionExpressions().get(i));
-      }
-      print(']');
-    }
+    printTypeName(x.getArrayType());
     if (x.getInitializers() != null) {
       print(" {");
       visitCollectionWithCommas(x.getInitializers().iterator());
       print('}');
-      return false;
+    } else {
+      for (int i = 0; i < x.getDimensionExpressions().size(); ++i) {
+        JExpression expr = x.getDimensionExpressions().get(i);
+        print('[');
+        accept(expr);
+        print(']');
+      }
     }
 
     return false;
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/codesplitter/CodeSplitters.java b/dev/core/src/com/google/gwt/dev/jjs/impl/codesplitter/CodeSplitters.java
index 015424b..fdf377b 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/codesplitter/CodeSplitters.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/codesplitter/CodeSplitters.java
@@ -238,7 +238,7 @@
           runAsync.getRunAsyncId()));
     }
     JNewArray newArray =
-        JNewArray.createInitializers(arg1.getSourceInfo(), arrayType,
+        JNewArray.createArrayWithInitializers(arg1.getSourceInfo(), arrayType,
             Lists.newArrayList(initializers));
     call.setArg(1, newArray);
   }
diff --git a/dev/core/super/javaemul/internal/ArrayStamper.java b/dev/core/super/javaemul/internal/ArrayStamper.java
index 53d2f48..7da1402 100644
--- a/dev/core/super/javaemul/internal/ArrayStamper.java
+++ b/dev/core/super/javaemul/internal/ArrayStamper.java
@@ -21,6 +21,6 @@
 class ArrayStamper {
   public static native <T> T[] stampJavaTypeInfo(Object array, T[] referenceType) /*-{
     return @com.google.gwt.lang.Array::stampJavaTypeInfo(
-        Ljava/lang/Object;[Ljava/lang/Object;)(array, referenceType);;
+        Ljava/lang/Object;[Ljava/lang/Object;)(array, referenceType);
   }-*/;
 }