Make sure classliteral fields related to JsVarargs array are created.

ImplementClassLiteralsAsField creates the classliteral fields in
ClassLiteralHolder only for the ones that are referenced.
JsVarargs normalization pass (ImplementJsVarargs) my insert array
instantiations for arrays that are not seen before therefore
missing the corresponding classliteral field for the leaf type.

Change-Id: Iea27a5e29e41693021dad9d6725104d904d42099
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/ImplementClassLiteralsAsFields.java b/dev/core/src/com/google/gwt/dev/jjs/impl/ImplementClassLiteralsAsFields.java
index 89e69ff..4a51dbd 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/ImplementClassLiteralsAsFields.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/ImplementClassLiteralsAsFields.java
@@ -34,6 +34,7 @@
 import com.google.gwt.dev.jjs.ast.JMethodCall;
 import com.google.gwt.dev.jjs.ast.JModVisitor;
 import com.google.gwt.dev.jjs.ast.JNullLiteral;
+import com.google.gwt.dev.jjs.ast.JParameter;
 import com.google.gwt.dev.jjs.ast.JPrimitiveType;
 import com.google.gwt.dev.jjs.ast.JProgram;
 import com.google.gwt.dev.jjs.ast.JReferenceType;
@@ -54,6 +55,7 @@
 import com.google.gwt.thirdparty.guava.common.base.Joiner;
 import com.google.gwt.thirdparty.guava.common.collect.ArrayListMultimap;
 import com.google.gwt.thirdparty.guava.common.collect.ImmutableMap;
+import com.google.gwt.thirdparty.guava.common.collect.Iterables;
 import com.google.gwt.thirdparty.guava.common.collect.Lists;
 import com.google.gwt.thirdparty.guava.common.collect.Maps;
 import com.google.gwt.thirdparty.guava.common.collect.Multimap;
@@ -226,6 +228,17 @@
     }
 
     @Override
+    public void endVisit(JMethod x, Context ctx) {
+      if (x.isJsMethodVarargs()) {
+        // ImplementJsVarargs might insert an array creation for the varargs parameter which is not
+        // seen by this pass.
+        JParameter varargsParameter = Iterables.getLast(x.getParams());
+        assert varargsParameter.isVarargs();
+        resolveClassLiteralField(((JArrayType) varargsParameter.getType()).getLeafType());
+      }
+    }
+
+    @Override
     public void endVisit(JsniClassLiteral x, Context ctx) {
       // JsniClassLiterals will be traversed explicitly in JsniMethodBody. For each JsniClassLiteral
       // in JsniMethodBody.classRefs there is at least a corresponding JsNameRef (with a jsni