Update Closure Compiler to v20160315

Change-Id: I94354fe3311e0bafb469f5a4273b2698cc19eace
diff --git a/dev/build.xml b/dev/build.xml
index 401717f..f1af6a0 100755
--- a/dev/build.xml
+++ b/dev/build.xml
@@ -69,8 +69,8 @@
           <include name="guava/guava-18.0/guava-18.0-rebased.jar"/>
           <include name="icu4j/50.1.1/icu4j.jar"/>
           <include name="jetty/jetty-9.2.14.v20151106/jetty-all-9.2.14.v20151106.jar"/>
-          <include name="jscomp/20131118.json.rebased/compiler-rebased.jar"/>
-          <include name="jscomp/20131118.json.rebased/sourcemap-rebased.jar"/>
+          <include name="jscomp/20160315/compiler-rebased.jar"/>
+          <include name="jscomp/20160315/sourcemap-rebased.jar"/>
           <include name="jsr305/jsr305.jar"/>
           <include name="protobuf/protobuf-2.5.0/protobuf-java-rebased-2.5.0.jar"/>
           <!-- dependencies needed for JSP support in DevMode: BEGIN -->
@@ -122,8 +122,8 @@
           <zipfileset src="${gwt.tools.lib}/icu4j/50.1.1/icu4j.jar"/>
           <zipfileset
               src="${gwt.tools.lib}/jetty/jetty-9.2.14.v20151106/jetty-all-9.2.14.v20151106.jar"/>
-          <zipfileset src="${gwt.tools.lib}/jscomp/20131118.json.rebased/compiler-rebased.jar"/>
-          <zipfileset src="${gwt.tools.lib}/jscomp/20131118.json.rebased/sourcemap-rebased.jar"/>
+          <zipfileset src="${gwt.tools.lib}/jscomp/20160315/compiler-rebased.jar"/>
+          <zipfileset src="${gwt.tools.lib}/jscomp/20160315/sourcemap-rebased.jar"/>
           <zipfileset src="${gwt.tools.lib}/jsr305/jsr305.jar"/>
           <zipfileset
               src="${gwt.tools.lib}/protobuf/protobuf-2.5.0/protobuf-java-rebased-2.5.0.jar"/>
@@ -206,8 +206,8 @@
             location="${gwt.tools.lib}/eclipse/jdtCompilerAdapter_3.11.2-CUSTOM-GWT-2.8-20160205.jar"/>
         <pathelement
             location="${gwt.tools.lib}/guava/guava-18.0/guava-18.0-rebased.jar"/>
-        <pathelement location="${gwt.tools.lib}/jscomp/20131118.json.rebased/compiler-rebased.jar"/>
-        <pathelement location="${gwt.tools.lib}/jscomp/20131118.json.rebased/sourcemap-rebased.jar"/>
+        <pathelement location="${gwt.tools.lib}/jscomp/20160315/compiler-rebased.jar"/>
+        <pathelement location="${gwt.tools.lib}/jscomp/20160315/sourcemap-rebased.jar"/>
         <pathelement location="${gwt.tools.lib}/json/android-sdk-19.1/json-android-rebased.jar"/>
         <pathelement location="${gwt.tools.lib}/jsr305/jsr305.jar"/>
         <pathelement
diff --git a/dev/core/src/com/google/gwt/dev/js/ClosureJsAstTranslator.java b/dev/core/src/com/google/gwt/dev/js/ClosureJsAstTranslator.java
index db03d31..60c8e04 100644
--- a/dev/core/src/com/google/gwt/dev/js/ClosureJsAstTranslator.java
+++ b/dev/core/src/com/google/gwt/dev/js/ClosureJsAstTranslator.java
@@ -71,13 +71,14 @@
 import com.google.gwt.dev.js.ast.NodeKind;
 import com.google.gwt.thirdparty.guava.common.base.Preconditions;
 import com.google.gwt.thirdparty.guava.common.collect.Sets;
+import com.google.gwt.thirdparty.javascript.jscomp.AbstractCompiler;
 import com.google.gwt.thirdparty.javascript.jscomp.AstValidator;
 import com.google.gwt.thirdparty.javascript.rhino.IR;
 import com.google.gwt.thirdparty.javascript.rhino.InputId;
 import com.google.gwt.thirdparty.javascript.rhino.Node;
+import com.google.gwt.thirdparty.javascript.rhino.SimpleSourceFile;
+import com.google.gwt.thirdparty.javascript.rhino.StaticSourceFile;
 import com.google.gwt.thirdparty.javascript.rhino.Token;
-import com.google.gwt.thirdparty.javascript.rhino.jstype.SimpleSourceFile;
-import com.google.gwt.thirdparty.javascript.rhino.jstype.StaticSourceFile;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -98,7 +99,7 @@
     }
   }
 
-  private final Map<String, StaticSourceFile> sourceCache = new HashMap<String, StaticSourceFile>();
+  private final Map<String, StaticSourceFile> sourceCache = new HashMap<>();
 
   private final boolean validate;
   private final Set<String> globalVars = Sets.newHashSet();
@@ -107,10 +108,12 @@
   private final Set<String> externalVars = Sets.newHashSet();
 
   private final JsProgram program;
+  private final AbstractCompiler compiler;
 
-  ClosureJsAstTranslator(boolean validate, JsProgram program) {
+  ClosureJsAstTranslator(boolean validate, JsProgram program, AbstractCompiler compiler) {
     this.program = program;
     this.validate = validate;
+    this.compiler = compiler;
   }
 
   public Node translate(JsProgramFragment fragment, InputId inputId, String source) {
@@ -123,7 +126,7 @@
     }
     // Validate the structural integrity of the AST.
     if (validate) {
-      new AstValidator().validateScript(script);
+      new AstValidator(compiler).validateScript(script);
     }
     return script;
   }
diff --git a/dev/core/src/com/google/gwt/dev/js/ClosureJsRunner.java b/dev/core/src/com/google/gwt/dev/js/ClosureJsRunner.java
index 365096d..01a6f0d 100644
--- a/dev/core/src/com/google/gwt/dev/js/ClosureJsRunner.java
+++ b/dev/core/src/com/google/gwt/dev/js/ClosureJsRunner.java
@@ -34,10 +34,10 @@
 import com.google.gwt.thirdparty.javascript.jscomp.DiagnosticGroups;
 import com.google.gwt.thirdparty.javascript.jscomp.JSError;
 import com.google.gwt.thirdparty.javascript.jscomp.JSModule;
-import com.google.gwt.thirdparty.javascript.jscomp.JSSourceFile;
 import com.google.gwt.thirdparty.javascript.jscomp.PropertyRenamingPolicy;
 import com.google.gwt.thirdparty.javascript.jscomp.Result;
 import com.google.gwt.thirdparty.javascript.jscomp.SourceAst;
+import com.google.gwt.thirdparty.javascript.jscomp.SourceFile;
 import com.google.gwt.thirdparty.javascript.jscomp.VariableMap;
 import com.google.gwt.thirdparty.javascript.jscomp.VariableRenamingPolicy;
 import com.google.gwt.thirdparty.javascript.jscomp.WarningLevel;
@@ -47,7 +47,7 @@
 import java.io.BufferedInputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.text.ParseException;
+import java.nio.charset.Charset;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
@@ -99,7 +99,7 @@
    * @return a mutable list
    * @throws IOException
    */
-  public static List<JSSourceFile> getDefaultExterns() throws IOException {
+  public static List<SourceFile> getDefaultExterns() throws IOException {
     Class<ClosureJsRunner> clazz = ClosureJsRunner.class;
     InputStream input = clazz.getResourceAsStream("/com/google/javascript/jscomp/externs.zip");
     if (input == null) {
@@ -110,14 +110,14 @@
       input = clazz.getResourceAsStream("/externs.zip");
     }
     ZipInputStream zip = new ZipInputStream(input);
-    Map<String, JSSourceFile> externsMap = Maps.newHashMap();
+    Map<String, SourceFile> externsMap = Maps.newHashMap();
     for (ZipEntry entry = null; (entry = zip.getNextEntry()) != null;) {
       BufferedInputStream entryStream =
           new BufferedInputStream(ByteStreams.limit(zip, entry.getSize()));
-      externsMap.put(entry.getName(), JSSourceFile.fromInputStream(
+      externsMap.put(entry.getName(), SourceFile.fromInputStream(
       // Give the files an odd prefix, so that they do not conflict
       // with the user's files.
-          "externs.zip//" + entry.getName(), entryStream));
+          "externs.zip//" + entry.getName(), entryStream, Charset.defaultCharset()));
     }
 
     Preconditions.checkState(externsMap.keySet().equals(Sets.newHashSet(DEFAULT_EXTERNS_NAMES)),
@@ -125,7 +125,7 @@
 
     // Order matters, so the resources must be added to the result list
     // in the expected order.
-    List<JSSourceFile> externs = Lists.newArrayList();
+    List<SourceFile> externs = Lists.newArrayList();
     for (String key : DEFAULT_EXTERNS_NAMES) {
       externs.add(externsMap.get(key));
     }
@@ -176,11 +176,8 @@
   public void compile(JProgram jprogram, JsProgram program, String[] js,
       JsOutputOption jsOutputOption) {
     CompilerOptions options;
-    try {
-      options = getClosureCompilerOptions(jsOutputOption);
-    } catch (ParseException e) {
-      throw new RuntimeException("Error setting closure compiler options", e);
-    }
+    options = getClosureCompilerOptions(jsOutputOption);
+
     // Turn off Closure Compiler logging
     Logger.getLogger("com.google.gwt.thirdparty.javascript.jscomp").setLevel(Level.OFF);
 
@@ -192,7 +189,7 @@
     List<JSModule> modules = createClosureModules(program);
 
     // Build the externs based on what we discovered building the modules.
-    List<JSSourceFile> externs = getClosureCompilerExterns();
+    List<SourceFile> externs = getClosureCompilerExterns();
 
     Result result = compiler.compileModules(externs, modules, options);
     if (result.success) {
@@ -209,8 +206,8 @@
     }
   }
 
-  protected List<JSSourceFile> getDefaultExternsList() {
-    List<JSSourceFile> defaultExterns;
+  protected List<SourceFile> getDefaultExternsList() {
+    List<SourceFile> defaultExterns;
     try {
       defaultExterns = getDefaultExterns();
       return defaultExterns;
@@ -275,7 +272,7 @@
       String source) {
     String inputName = source;
     InputId inputId = new InputId(inputName);
-    ClosureJsAstTranslator translator = new ClosureJsAstTranslator(validate, program);
+    ClosureJsAstTranslator translator = new ClosureJsAstTranslator(validate, program, compiler);
     Node root = translator.translate(fragment, inputId, source);
     globalVars.addAll(translator.getGlobalVariableNames());
     externalProps.addAll(translator.getExternalPropertyReferences());
@@ -315,14 +312,14 @@
         modules[i].addDependency(leftovers);
       }
     }
-    modules[0].add(JSSourceFile.fromCode("hack", "window['gwtOnLoad'] = gwtOnLoad;\n"));
+    modules[0].add(SourceFile.fromCode("hack", "window['gwtOnLoad'] = gwtOnLoad;\n"));
 
     return Arrays.asList(modules);
   }
 
-  private List<JSSourceFile> getClosureCompilerExterns() {
-    List<JSSourceFile> externs = getDefaultExternsList();
-    externs.add(JSSourceFile.fromCode("gwt_externs",
+  private List<SourceFile> getClosureCompilerExterns() {
+    List<SourceFile> externs = getDefaultExternsList();
+    externs.add(SourceFile.fromCode("gwt_externs",
 
     "var gwtOnLoad;\n"
         + "var $entry;\n"
@@ -356,13 +353,12 @@
       generatedExterns += "var " + var + ";\n";
     }
 
-    externs.add(JSSourceFile.fromCode("gwt_generated_externs", generatedExterns));
+    externs.add(SourceFile.fromCode("gwt_generated_externs", generatedExterns));
 
     return externs;
   }
 
-  private CompilerOptions getClosureCompilerOptions(JsOutputOption jsOutputOption)
-      throws ParseException {
+  private CompilerOptions getClosureCompilerOptions(JsOutputOption jsOutputOption) {
     CompilerOptions options = new CompilerOptions();
     WarningLevel.QUIET.setOptionsForWarningLevel(options);
 
@@ -370,11 +366,11 @@
 
     // Build an identity map of variable names to prevent GWT names from
     // being renamed while allowing new global variables to be renamed.
-    HashMap<String, String> varNames = new HashMap<String, String>();
+    HashMap<String, String> varNames = new HashMap<>();
     for (String var : globalVars) {
       varNames.put(var, var);
     }
-    options.setInputVariableMapSerialized(VariableMap.fromMap(varNames).toBytes());
+    options.setInputVariableMap(VariableMap.fromMap(varNames));
     if (jsOutputOption == JsOutputOption.OBFUSCATED) {
       options.setRenamingPolicy(VariableRenamingPolicy.ALL, PropertyRenamingPolicy.OFF);
       options.setPrettyPrint(false);
@@ -412,7 +408,7 @@
     options.setFlowSensitiveInlineVariables(true);
     options.setComputeFunctionSideEffects(true);
     // Remove unused vars also removes unused functions.
-    options.setRemoveUnusedVariable(Reach.ALL);
+    options.setRemoveUnusedVariables(Reach.ALL);
     options.setOptimizeParameters(true);
     options.setOptimizeReturns(true);
     options.setOptimizeCalls(true);
@@ -425,7 +421,6 @@
 
     // Advanced optimization, disabled
     options.setRemoveClosureAsserts(false);
-    options.setAliasKeywords(false);
     options.setRemoveUnusedPrototypePropertiesInExterns(false);
     options.setCheckGlobalThisLevel(CheckLevel.OFF);
     options.setRewriteFunctionExpressions(false); // Performance hit
diff --git a/eclipse/dev/.classpath b/eclipse/dev/.classpath
index 4419743..1e421b3 100644
--- a/eclipse/dev/.classpath
+++ b/eclipse/dev/.classpath
@@ -23,8 +23,8 @@
 	<classpathentry kind="var" path="GWT_TOOLS/lib/htmlunit/htmlunit-2.19/htmlunit-core-js-2.15.jar"/>
 	<classpathentry kind="var" path="GWT_TOOLS/lib/protobuf/protobuf-2.5.0/protobuf-java-rebased-2.5.0.jar"/>
 	<classpathentry kind="var" path="GWT_TOOLS/lib/guava/guava-18.0/guava-18.0-rebased.jar"/>
-	<classpathentry kind="var" path="GWT_TOOLS/lib/jscomp/20131118.json.rebased/sourcemap-rebased.jar"/>
-	<classpathentry kind="var" path="GWT_TOOLS/lib/jscomp/20131118.json.rebased/compiler-rebased.jar"/>
+	<classpathentry kind="var" path="GWT_TOOLS/lib/jscomp/20160315/sourcemap-rebased.jar"/>
+	<classpathentry kind="var" path="GWT_TOOLS/lib/jscomp/20160315/compiler-rebased.jar"/>
 	<classpathentry kind="var" path="GWT_TOOLS/lib/json/android-sdk-19.1/json-android-rebased.jar"/>
 	<classpathentry kind="var" path="GWT_TOOLS/lib/apache/commons/commons-collections-3.2.2.jar"/>
 	<classpathentry exported="true" kind="var" path="GWT_TOOLS/lib/tomcat/tomcat-servlet-api-8.0.28.jar"/>
diff --git a/eclipse/dev/codeserver/.classpath b/eclipse/dev/codeserver/.classpath
index 96354aa..34c26c9 100644
--- a/eclipse/dev/codeserver/.classpath
+++ b/eclipse/dev/codeserver/.classpath
@@ -4,8 +4,8 @@
 	<classpathentry kind="src" path="codeserver/javatests"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="var" path="GWT_TOOLS/lib/guava/guava-18.0/guava-18.0-rebased.jar"/>
-	<classpathentry kind="var" path="GWT_TOOLS/lib/jscomp/20131118.json.rebased/sourcemap-rebased.jar"/>
-	<classpathentry kind="var" path="GWT_TOOLS/lib/jscomp/20131118.json.rebased/compiler-rebased.jar"/>
+	<classpathentry kind="var" path="GWT_TOOLS/lib/jscomp/20160315/sourcemap-rebased.jar"/>
+	<classpathentry kind="var" path="GWT_TOOLS/lib/jscomp/20160315/compiler-rebased.jar"/>
 	<classpathentry kind="var" path="GWT_TOOLS/lib/junit/junit-4.8.2.jar" sourcepath="/GWT_TOOLS/lib/junit/junit-4.8.2-src.zip"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/gwt-dev"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/gwt-user"/>
diff --git a/eclipse/user/.classpath b/eclipse/user/.classpath
index f4db2ad..4179dd4 100644
--- a/eclipse/user/.classpath
+++ b/eclipse/user/.classpath
@@ -60,7 +60,7 @@
 	<classpathentry kind="var" path="GWT_TOOLS/lib/testng/testng-5.14.1-sources.jar"/>
 	<classpathentry kind="var" path="GWT_TOOLS/lib/testng/testng-5.14.1-nojunit.jar" sourcepath="/GWT_TOOLS/lib/testng/testng-5.14.1-sources.jar"/>
 	<classpathentry kind="var" path="GWT_TOOLS/lib/protobuf/protobuf-2.5.0/protobuf-java-rebased-2.5.0.jar"/>
-	<classpathentry kind="var" path="GWT_TOOLS/lib/jscomp/20131118.json.rebased/sourcemap-rebased.jar"/>
+	<classpathentry kind="var" path="GWT_TOOLS/lib/jscomp/20160315/sourcemap-rebased.jar"/>
 	<classpathentry kind="var" path="GWT_TOOLS/lib/eclipse/org.eclipse.jdt.core_3.11.2-CUSTOM-GWT-2.8-20160205.jar"/>
 	<classpathentry kind="var" path="GWT_TOOLS/lib/eclipse/jdtCompilerAdapter_3.11.2-CUSTOM-GWT-2.8-20160205.jar"/>
 	<classpathentry kind="output" path="bin"/>
diff --git a/servlet/build.xml b/servlet/build.xml
index 7ea16fa..b06bb4a 100644
--- a/servlet/build.xml
+++ b/servlet/build.xml
@@ -26,7 +26,7 @@
       <!-- Rebased dependencies go in gwt-servlet too -->
       <zipfileset src="${gwt.tools.lib}/colt/colt-1.2.jar" />
       <zipfileset src="${gwt.tools.lib}/guava/guava-18.0/guava-18.0-rebased.jar" />
-      <zipfileset src="${gwt.tools.lib}/jscomp/20131118.json.rebased/sourcemap-rebased.jar" />
+      <zipfileset src="${gwt.tools.lib}/jscomp/20160315/sourcemap-rebased.jar" />
       <zipfileset src="${gwt.tools.lib}/json/android-sdk-19.1/json-android-rebased.jar" />
       <zipfileset src="${gwt.tools.lib}/streamhtmlparser/streamhtmlparser-jsilver-r10/streamhtmlparser-jsilver-r10-1.5-rebased.jar" />
       <zipfileset src="${gwt.tools.lib}/protobuf/protobuf-2.5.0/protobuf-java-rebased-2.5.0.jar" />