Add JEP286 (Local-Variable Type Inference) support.

Bug: #9609
Bug-Link: https://github.com/gwtproject/gwt/issues/9609
Change-Id: Ia2d7e8af11d78b31ac0a4db0b2a0205324b6de0e
diff --git a/dev/build.xml b/dev/build.xml
index 5afde31..e47beeb 100755
--- a/dev/build.xml
+++ b/dev/build.xml
@@ -74,11 +74,11 @@
           <include name="apache/tapestry-util-text-4.0.2.jar"/>
           <include name="apache/ant-1.6.5.jar"/>
           <include name="colt/colt-1.2.jar"/>
-          <include name="eclipse/org.eclipse.jdt.core_3.13.100-CUSTOM-GWT-20180108.jar"/>
-          <include name="eclipse/jdtCompilerAdapter_3.13.100-CUSTOM-GWT-20180108.jar"/>
-          <include name="objectweb/asm-6.0/asm-6.0.jar"/>
-          <include name="objectweb/asm-6.0/asm-commons-6.0.jar"/>
-          <include name="objectweb/asm-6.0/asm-util-6.0.jar"/>
+          <include name="eclipse/org.eclipse.jdt.core_3.13.102-CUSTOM-GWT-20180415.jar"/>
+          <include name="eclipse/jdtCompilerAdapter_3.13.102-CUSTOM-GWT-20180415.jar"/>
+          <include name="objectweb/asm-6.1.1/asm-6.1.1.jar"/>
+          <include name="objectweb/asm-6.1.1/asm-commons-6.1.1.jar"/>
+          <include name="objectweb/asm-6.1.1/asm-util-6.1.1.jar"/>
           <include name="guava/guava-19.0/guava-19.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"/>
@@ -128,16 +128,16 @@
             <provider classname="org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer"/>
             <provider classname="org.eclipse.jetty.apache.jsp.JettyJasperInitializer"/>
           </service>
-          <zipfileset src="${gwt.tools.lib}/objectweb/asm-6.0/asm-6.0.jar"/>
-          <zipfileset src="${gwt.tools.lib}/objectweb/asm-6.0/asm-commons-6.0.jar"/>
-          <zipfileset src="${gwt.tools.lib}/objectweb/asm-6.0/asm-util-6.0.jar"/>
+          <zipfileset src="${gwt.tools.lib}/objectweb/asm-6.1.1/asm-6.1.1.jar"/>
+          <zipfileset src="${gwt.tools.lib}/objectweb/asm-6.1.1/asm-commons-6.1.1.jar"/>
+          <zipfileset src="${gwt.tools.lib}/objectweb/asm-6.1.1/asm-util-6.1.1.jar"/>
           <zipfileset src="${gwt.tools.lib}/apache/tapestry-util-text-4.0.2.jar"/>
           <zipfileset src="${gwt.tools.lib}/apache/ant-1.6.5.jar"/>
           <zipfileset src="${gwt.tools.lib}/colt/colt-1.2.jar"/>
           <zipfileset
-              src="${gwt.tools.lib}/eclipse/org.eclipse.jdt.core_3.13.100-CUSTOM-GWT-20180108.jar"/>
+              src="${gwt.tools.lib}/eclipse/org.eclipse.jdt.core_3.13.102-CUSTOM-GWT-20180415.jar"/>
           <zipfileset
-              src="${gwt.tools.lib}/eclipse/jdtCompilerAdapter_3.13.100-CUSTOM-GWT-20180108.jar"/>
+              src="${gwt.tools.lib}/eclipse/jdtCompilerAdapter_3.13.102-CUSTOM-GWT-20180415.jar"/>
           <zipfileset src="${gwt.tools.lib}/guava/guava-19.0/guava-19.0-rebased.jar"/>
           <zipfileset src="${gwt.tools.lib}/icu4j/50.1.1/icu4j.jar"/>
           <zipfileset
@@ -222,15 +222,15 @@
       <classpath>
         <pathelement location="${gwt.tools.lib}/apache/ant-1.6.5.jar"/>
         <pathelement location="${gwt.tools.lib}/colt/colt-1.2.jar"/>
-        <pathelement location="${gwt.tools.lib}/objectweb/asm-6.0/asm-6.0.jar"/>
-        <pathelement location="${gwt.tools.lib}/objectweb/asm-6.0/asm-commons-6.0.jar"/>
-        <pathelement location="${gwt.tools.lib}/objectweb/asm-6.0/asm-util-6.0.jar"/>
+        <pathelement location="${gwt.tools.lib}/objectweb/asm-6.1.1/asm-6.1.1.jar"/>
+        <pathelement location="${gwt.tools.lib}/objectweb/asm-6.1.1/asm-commons-6.1.1.jar"/>
+        <pathelement location="${gwt.tools.lib}/objectweb/asm-6.1.1/asm-util-6.1.1.jar"/>
         <pathelement
             location="${gwt.tools.lib}/apache/commons/commons-collections-3.2.2.jar"/>
         <pathelement
-            location="${gwt.tools.lib}/eclipse/org.eclipse.jdt.core_3.13.100-CUSTOM-GWT-20180108.jar"/>
+            location="${gwt.tools.lib}/eclipse/org.eclipse.jdt.core_3.13.102-CUSTOM-GWT-20180415.jar"/>
         <pathelement
-            location="${gwt.tools.lib}/eclipse/jdtCompilerAdapter_3.13.100-CUSTOM-GWT-20180108.jar"/>
+            location="${gwt.tools.lib}/eclipse/jdtCompilerAdapter_3.13.102-CUSTOM-GWT-20180415.jar"/>
         <pathelement
             location="${gwt.tools.lib}/guava/guava-19.0/guava-19.0-rebased.jar"/>
         <pathelement location="${gwt.tools.lib}/gson/gson-2.6.2.jar"/>
diff --git a/dev/core/src/com/google/gwt/dev/javac/GwtIncompatiblePreprocessor.java b/dev/core/src/com/google/gwt/dev/javac/GwtIncompatiblePreprocessor.java
index 426cb53..326d973 100644
--- a/dev/core/src/com/google/gwt/dev/javac/GwtIncompatiblePreprocessor.java
+++ b/dev/core/src/com/google/gwt/dev/javac/GwtIncompatiblePreprocessor.java
@@ -24,7 +24,6 @@
 import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
 import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression;
 import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
-import org.eclipse.jdt.internal.compiler.ast.TypeReference;
 import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
 import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
 
@@ -98,7 +97,8 @@
     }
 
     if (newMethods.size() != tyDecl.methods.length) {
-      tyDecl.methods = newMethods.toArray(new AbstractMethodDeclaration[newMethods.size()]);
+      tyDecl.methods = newMethods.isEmpty() ? null : newMethods.toArray(
+          new AbstractMethodDeclaration[newMethods.size()]);
     }
   }
 
@@ -118,7 +118,8 @@
     }
 
     if (newFields.size() != tyDecl.fields.length) {
-      tyDecl.fields = newFields.toArray(new FieldDeclaration[newFields.size()]);
+      tyDecl.fields = newFields.isEmpty() ? null : newFields.toArray(new FieldDeclaration[newFields
+          .size()]);
     }
   }
 
@@ -151,11 +152,11 @@
       return;
     }
     tyDecl.superclass = null;
-    tyDecl.superInterfaces = new TypeReference[0];
-    tyDecl.annotations = new Annotation[0];
-    tyDecl.methods = new AbstractMethodDeclaration[0];
-    tyDecl.memberTypes = new TypeDeclaration[0];
-    tyDecl.fields = new FieldDeclaration[0];
+    tyDecl.superInterfaces = null;
+    tyDecl.annotations = null;
+    tyDecl.methods = null;
+    tyDecl.memberTypes = null;
+    tyDecl.fields = null;
     if (TypeDeclaration.kind(tyDecl.modifiers) == TypeDeclaration.CLASS_DECL) {
       // Create a default constructor so that the class is proper.
       ConstructorDeclaration constructor = tyDecl.createDefaultConstructor(true, true);
diff --git a/dev/core/src/com/google/gwt/dev/javac/JavaSourceParser.java b/dev/core/src/com/google/gwt/dev/javac/JavaSourceParser.java
index 600e1fa..cc3fa6d 100644
--- a/dev/core/src/com/google/gwt/dev/javac/JavaSourceParser.java
+++ b/dev/core/src/com/google/gwt/dev/javac/JavaSourceParser.java
@@ -123,6 +123,9 @@
   private static List<AbstractMethodDeclaration> findNamedMethods(
       TypeDeclaration type, String name) {
     List<AbstractMethodDeclaration> matching = new ArrayList<AbstractMethodDeclaration>();
+    if (type.methods == null) {
+      return matching;
+    }
     boolean isCtor = "<init>".equals(name);
     char[] nameArray = name.toCharArray();
     for (AbstractMethodDeclaration method : type.methods) {
@@ -163,6 +166,9 @@
    * @return matching type or null if not found
    */
   private static TypeDeclaration findType(TypeDeclaration[] types, char[] name) {
+    if (types == null) {
+      return null;
+    }
     for (TypeDeclaration type : types) {
       if (Arrays.equals(name, type.name)) {
         return type;
diff --git a/dev/core/src/com/google/gwt/dev/javac/JdtCompiler.java b/dev/core/src/com/google/gwt/dev/javac/JdtCompiler.java
index 88ff022..af7e4c5 100644
--- a/dev/core/src/com/google/gwt/dev/javac/JdtCompiler.java
+++ b/dev/core/src/com/google/gwt/dev/javac/JdtCompiler.java
@@ -785,7 +785,8 @@
   private static final Map<SourceLevel, Long> jdtLevelByGwtLevel =
       ImmutableMap.<SourceLevel, Long>of(
           SourceLevel.JAVA8, ClassFileConstants.JDK1_8,
-          SourceLevel.JAVA9, ClassFileConstants.JDK9);
+          SourceLevel.JAVA9, ClassFileConstants.JDK9,
+          SourceLevel.JAVA10, ClassFileConstants.JDK10);
 
   public JdtCompiler(CompilerContext compilerContext, UnitProcessor processor) {
     this.compilerContext = compilerContext;
diff --git a/dev/core/src/com/google/gwt/dev/javac/JdtUtil.java b/dev/core/src/com/google/gwt/dev/javac/JdtUtil.java
index 06e96a8..4091260 100644
--- a/dev/core/src/com/google/gwt/dev/javac/JdtUtil.java
+++ b/dev/core/src/com/google/gwt/dev/javac/JdtUtil.java
@@ -79,7 +79,8 @@
   }
 
   /**
-   * Returns the name of the class from reference binding.
+   * Returns the fully qualified source name of the type (class, interface or enum) from reference
+   * binding.
    * <p>
    * JDT Core (at least 3.11.0.v20150407) returns <code>$Local$</code> synthetic name for local
    * classes.<br>
@@ -88,7 +89,7 @@
    * <code>test.Class1$2</code>).
    * </p>
    */
-  public static String getClassName(ReferenceBinding binding) {
+  public static String getQualifiedSourceName(ReferenceBinding binding) {
     if (binding instanceof LocalTypeBinding) {
       // Using here constantPoolName() instead of coumpoundName due JDT not computing the
       // right compoundName for lambdas inside local class.
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 471c7c2..07178c7 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
@@ -215,7 +215,6 @@
 import org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope;
 import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
 import org.eclipse.jdt.internal.compiler.lookup.IntersectionTypeBinding18;
-import org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding;
 import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
 import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
 import org.eclipse.jdt.internal.compiler.lookup.MethodScope;
@@ -4355,14 +4354,7 @@
     SourceInfo info = makeSourceInfo(x);
     try {
       SourceTypeBinding binding = x.binding;
-      String name;
-      if (binding instanceof LocalTypeBinding) {
-        char[] localName = binding.constantPoolName();
-        name = new String(localName).replace('/', '.');
-      } else {
-        name = JdtUtil.asDottedString(binding.compoundName);
-      }
-      name = intern(name);
+      String name = intern(JdtUtil.getQualifiedSourceName(binding));
 
       JDeclaredType type;
       if (binding.isClass()) {
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/ReferenceMapper.java b/dev/core/src/com/google/gwt/dev/jjs/impl/ReferenceMapper.java
index 77b5363..e63ad4d 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/ReferenceMapper.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/ReferenceMapper.java
@@ -288,7 +288,7 @@
   }
 
   private JDeclaredType createType(ReferenceBinding binding) {
-    String name = JdtUtil.asDottedString(binding.compoundName);
+    String name = JdtUtil.getQualifiedSourceName(binding);
     SourceInfo info = SourceOrigin.UNKNOWN;
     if (binding.isClass()) {
       return new JClassType(info, name, binding.isAbstract(), binding.isFinal());
diff --git a/dev/core/src/com/google/gwt/dev/util/arg/SourceLevel.java b/dev/core/src/com/google/gwt/dev/util/arg/SourceLevel.java
index 529cab6..1243189 100644
--- a/dev/core/src/com/google/gwt/dev/util/arg/SourceLevel.java
+++ b/dev/core/src/com/google/gwt/dev/util/arg/SourceLevel.java
@@ -24,7 +24,8 @@
 public enum SourceLevel {
   // Source levels must appear in ascending order for the default setting logic to work.
   JAVA8("1.8", "8"),
-  JAVA9("1.9", "9");
+  JAVA9("1.9", "9"),
+  JAVA10("1.10", "10");
 
   /**
    * The default java sourceLevel.
@@ -98,5 +99,12 @@
     // If everything fails set default to JAVA8.
     return JAVA8;
   }
+
+  /**
+   * Returns the highest supported version of the Java.
+   */
+  public static SourceLevel getHighest() {
+    return SourceLevel.values()[SourceLevel.values().length - 1];
+  }
 }
 
diff --git a/dev/core/test/com/google/gwt/dev/CompilerTest.java b/dev/core/test/com/google/gwt/dev/CompilerTest.java
index 8c974d6..1b05279 100644
--- a/dev/core/test/com/google/gwt/dev/CompilerTest.java
+++ b/dev/core/test/com/google/gwt/dev/CompilerTest.java
@@ -958,6 +958,7 @@
     assertEquals(SourceLevel.JAVA8, SourceLevel.getBestMatchingVersion("1.7"));
     assertEquals(SourceLevel.JAVA8, SourceLevel.getBestMatchingVersion("1.8"));
     assertEquals(SourceLevel.JAVA9, SourceLevel.getBestMatchingVersion("1.9"));
+    assertEquals(SourceLevel.JAVA10, SourceLevel.getBestMatchingVersion("1.10"));
 
     // not proper version strings => default to JAVA8.
     assertEquals(SourceLevel.JAVA8, SourceLevel.getBestMatchingVersion("1.6u3"));
@@ -965,6 +966,10 @@
     assertEquals(SourceLevel.JAVA8, SourceLevel.getBestMatchingVersion("1.7b3"));
   }
 
+  public void testSourceLevelHighestVersion() {
+    assertEquals(SourceLevel.values()[SourceLevel.values().length - 1], SourceLevel.getHighest());
+  }
+
   /**
    * Verify that a compile with a @JsType at least compiles successfully.
    */
@@ -1696,7 +1701,7 @@
     File applicationDir = Files.createTempDir();
     CompilerOptions compilerOptions = new CompilerOptionsImpl();
     compilerOptions.setUseDetailedTypeIds(true);
-    compilerOptions.setSourceLevel(SourceLevel.JAVA9);
+    compilerOptions.setSourceLevel(SourceLevel.JAVA10);
 
     // Compile the application with no errors.
     compileToJs(TreeLogger.NULL, compilerOptions, applicationDir, "com.foo.Errors",
@@ -1759,7 +1764,7 @@
     File applicationDir = Files.createTempDir();
     CompilerOptions compilerOptions = new CompilerOptionsImpl();
     compilerOptions.setUseDetailedTypeIds(true);
-    compilerOptions.setSourceLevel(SourceLevel.JAVA9);
+    compilerOptions.setSourceLevel(SourceLevel.JAVA10);
     compilerOptions.setGenerateJsInteropExports(false);
 
     // Compile the application with no errors.
@@ -2110,7 +2115,7 @@
 
     CompilerOptions compilerOptions = new CompilerOptionsImpl();
     compilerOptions.setUseDetailedTypeIds(true);
-    compilerOptions.setSourceLevel(SourceLevel.JAVA9);
+    compilerOptions.setSourceLevel(SourceLevel.JAVA10);
 
     checkRecompiledModifiedApp(compilerOptions, "com.foo.DefaultMethod",
         Lists.newArrayList(moduleResource, entryPointResource, aSubclass,
diff --git a/dev/core/test/com/google/gwt/dev/javac/Java7JdtCompilerTest.java b/dev/core/test/com/google/gwt/dev/javac/Java7JdtCompilerTest.java
index 6794c33..5666638 100644
--- a/dev/core/test/com/google/gwt/dev/javac/Java7JdtCompilerTest.java
+++ b/dev/core/test/com/google/gwt/dev/javac/Java7JdtCompilerTest.java
@@ -16,7 +16,6 @@
 package com.google.gwt.dev.javac;
 
 import com.google.gwt.dev.javac.testing.impl.Java7MockResources;
-import com.google.gwt.dev.util.arg.SourceLevel;
 
 
 /**
@@ -47,10 +46,4 @@
     assertResourcesCompileSuccessfully(Java7MockResources.EXCEPTION1, Java7MockResources.EXCEPTION2,
         Java7MockResources.MULTI_EXCEPTION_TEST);
   }
-
-  @Override
-  protected SourceLevel getSourceLevel() {
-    // Always compile this tests as Java 9.
-    return SourceLevel.JAVA9;
-  }
 }
diff --git a/dev/core/test/com/google/gwt/dev/javac/JdtCompilerTestBase.java b/dev/core/test/com/google/gwt/dev/javac/JdtCompilerTestBase.java
index 25584d9..9f6e9d1 100644
--- a/dev/core/test/com/google/gwt/dev/javac/JdtCompilerTestBase.java
+++ b/dev/core/test/com/google/gwt/dev/javac/JdtCompilerTestBase.java
@@ -61,7 +61,7 @@
    * <p>Override this method in the derived test case to request a specific source level.
    */
   protected SourceLevel getSourceLevel() {
-    return SourceLevel.DEFAULT_SOURCE_LEVEL;
+    return SourceLevel.getHighest();
   }
 
   protected static void addAll(Collection<CompilationUnitBuilder> units, Resource... sourceFiles) {
diff --git a/dev/core/test/com/google/gwt/dev/jjs/impl/GwtAstBuilderTest.java b/dev/core/test/com/google/gwt/dev/jjs/impl/GwtAstBuilderTest.java
index d332443..251d27c 100644
--- a/dev/core/test/com/google/gwt/dev/jjs/impl/GwtAstBuilderTest.java
+++ b/dev/core/test/com/google/gwt/dev/jjs/impl/GwtAstBuilderTest.java
@@ -41,7 +41,6 @@
 import com.google.gwt.dev.jjs.ast.JVariable;
 import com.google.gwt.dev.jjs.ast.JVisitor;
 import com.google.gwt.dev.resource.Resource;
-import com.google.gwt.dev.util.arg.SourceLevel;
 import com.google.gwt.thirdparty.guava.common.collect.Lists;
 import com.google.gwt.thirdparty.guava.common.collect.Sets;
 
@@ -179,13 +178,9 @@
             + "  }",
         "}"
     ));
-
-    sourceLevel = SourceLevel.DEFAULT_SOURCE_LEVEL;
   }
 
   public void testNestedClassDisposition() throws UnableToCompleteException {
-    sourceLevel = SourceLevel.JAVA9;
-
     sources.add(JavaResourceBase.createMockJavaResource("test.NestedClasses",
         "package test;",
         "public class NestedClasses {",
@@ -238,8 +233,6 @@
   }
 
   public void testIntersectionBound() throws UnableToCompleteException {
-    sourceLevel = SourceLevel.JAVA9;
-
     sources.add(JavaResourceBase.createMockJavaResource("test.IntersectionBound",
         "package test;",
         "public class IntersectionBound {",
@@ -278,8 +271,6 @@
   }
 
   public void testBridgeMethodResolution() throws UnableToCompleteException {
-    sourceLevel = SourceLevel.JAVA9;
-
     sources.add(JavaResourceBase.createMockJavaResource("test.SuperInterface",
         "package test;",
         "public interface SuperInterface<T> {",
diff --git a/dev/core/test/com/google/gwt/dev/jjs/impl/JJSTestBase.java b/dev/core/test/com/google/gwt/dev/jjs/impl/JJSTestBase.java
index 74ff099..c89efdf 100644
--- a/dev/core/test/com/google/gwt/dev/jjs/impl/JJSTestBase.java
+++ b/dev/core/test/com/google/gwt/dev/jjs/impl/JJSTestBase.java
@@ -361,7 +361,7 @@
   /**
    * Java source level compatibility option.
    */
-  protected SourceLevel sourceLevel = SourceLevel.DEFAULT_SOURCE_LEVEL;
+  protected SourceLevel sourceLevel = SourceLevel.getHighest();
 
   protected static <T> void assertContainsAll(Iterable<T> expectedMethodSnippets,
       Set<T> actualMethodSnippets) {
diff --git a/dev/core/test/com/google/gwt/dev/jjs/impl/Java10AstTest.java b/dev/core/test/com/google/gwt/dev/jjs/impl/Java10AstTest.java
new file mode 100644
index 0000000..ddb1233
--- /dev/null
+++ b/dev/core/test/com/google/gwt/dev/jjs/impl/Java10AstTest.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2018 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 License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.dev.jjs.impl;
+
+import com.google.gwt.dev.javac.testing.impl.JavaResourceBase;
+import com.google.gwt.dev.jjs.ast.JDeclarationStatement;
+import com.google.gwt.dev.jjs.ast.JMethod;
+import com.google.gwt.dev.jjs.ast.JMethodBody;
+import com.google.gwt.dev.jjs.ast.JProgram;
+import com.google.gwt.dev.jjs.ast.JStatement;
+import com.google.gwt.dev.jjs.ast.JVariableRef;
+
+/**
+ * Tests that {@link com.google.gwt.dev.jjs.impl.GwtAstBuilder} correctly builds the AST for
+ * features introduced in Java 10.
+ */
+public class Java10AstTest extends FullCompileTestBase {
+
+  @Override
+  public void setUp() throws Exception {
+    super.setUp();
+    addAll(JavaResourceBase.createMockJavaResource("java.util.Iterator",
+        "package java.util;",
+        "public interface Iterator<E> {",
+        "  boolean hasNext();",
+        "  boolean next();",
+        "}"
+    ));
+    addAll(JavaResourceBase.createMockJavaResource("java.lang.Iterable",
+        "package java.lang;",
+        "public interface Iterable<E> {",
+        "  java.util.Iterator<E> iterator();",
+        "}"
+    ));
+  }
+
+  public void testLocalVarType_Simple() throws Exception {
+    assertEqualBlock(
+        "int i=42;",
+        "var i=42;");
+    assertEqualBlock(
+        "String i=\"42\";",
+        "var i=\"42\";");
+  }
+
+  public void testLocalVarType_AnonymousClass() throws Exception {
+    JProgram program = compileSnippet("void", "var o=new Object(){};");
+    JMethod method = findMainMethod(program);
+    JStatement varDeclarationStmt = ((JMethodBody) method.getBody()).getStatements().get(0);
+    JVariableRef variableRef = ((JDeclarationStatement) varDeclarationStmt).getVariableRef();
+    assertEquals("Should be anonymous class name",
+        "test.EntryPoint$1", variableRef.getType().getName());
+  }
+
+  public void testLocalVarType_ForLoop() throws Exception {
+    assertEqualBlock(
+        "for(int i=0;;);",
+        "for(var i=0;;);");
+  }
+
+  public void testLocalVarType_EnhancedForLoopArray() throws Exception {
+    assertEqualBlock(
+          "for(final String[] s$array=new String[]{},s$index=0,s$max=s$array.length;"
+        + "          s$index<s$max;++s$index){"
+        + "  String s=s$array[s$index];"
+        + "}"
+        ,
+          "for(var s : new String[]{});");
+  }
+
+  public void testLocalVarType_EnhancedForLoopIterable() throws Exception {
+    assertEqualBlock(
+          "for(Iterator s$iterator=((Iterable)null).iterator();s$iterator.hasNext();){"
+        + "  String s=(String)s$iterator.next();"
+        + "}"
+          ,
+          "for (var s : (Iterable<String>)null);"
+        );
+  }
+
+  @Override
+  protected void optimizeJava() {
+  }
+}
\ No newline at end of file
diff --git a/dev/core/test/com/google/gwt/dev/jjs/impl/Java7AstTest.java b/dev/core/test/com/google/gwt/dev/jjs/impl/Java7AstTest.java
index 30c42be..16dfd45 100644
--- a/dev/core/test/com/google/gwt/dev/jjs/impl/Java7AstTest.java
+++ b/dev/core/test/com/google/gwt/dev/jjs/impl/Java7AstTest.java
@@ -19,7 +19,6 @@
 import com.google.gwt.dev.javac.testing.impl.Java7MockResources;
 import com.google.gwt.dev.javac.testing.impl.JavaResourceBase;
 import com.google.gwt.dev.jjs.ast.JExpression;
-import com.google.gwt.dev.util.arg.SourceLevel;
 
 /**
  * Tests that {@link GwtAstBuilder} correctly builds the AST for features introduced in Java 7.
@@ -30,7 +29,6 @@
   // of nodes.
   @Override
   public void setUp() {
-    sourceLevel = SourceLevel.JAVA9;
     addAll(JavaResourceBase.AUTOCLOSEABLE, Java7MockResources.TEST_RESOURCE,
         Java7MockResources.EXCEPTION1, Java7MockResources.EXCEPTION2);
   }
diff --git a/dev/core/test/com/google/gwt/dev/jjs/impl/Java8AstTest.java b/dev/core/test/com/google/gwt/dev/jjs/impl/Java8AstTest.java
index f8b40b4..fd3f5df 100644
--- a/dev/core/test/com/google/gwt/dev/jjs/impl/Java8AstTest.java
+++ b/dev/core/test/com/google/gwt/dev/jjs/impl/Java8AstTest.java
@@ -24,7 +24,6 @@
 import com.google.gwt.dev.jjs.ast.JMethodBody;
 import com.google.gwt.dev.jjs.ast.JPrimitiveType;
 import com.google.gwt.dev.jjs.ast.JProgram;
-import com.google.gwt.dev.util.arg.SourceLevel;
 import com.google.gwt.thirdparty.guava.common.base.Joiner;
 
 import java.util.Collections;
@@ -37,7 +36,6 @@
 
   @Override
   public void setUp() throws Exception {
-    sourceLevel = SourceLevel.JAVA9;
     super.setUp();
     addAll(LAMBDA_METAFACTORY);
 
diff --git a/dev/core/test/com/google/gwt/dev/jjs/impl/Java9AstTest.java b/dev/core/test/com/google/gwt/dev/jjs/impl/Java9AstTest.java
index 9856840..8e1ae00 100644
--- a/dev/core/test/com/google/gwt/dev/jjs/impl/Java9AstTest.java
+++ b/dev/core/test/com/google/gwt/dev/jjs/impl/Java9AstTest.java
@@ -20,7 +20,6 @@
 import com.google.gwt.dev.jjs.ast.JMethod;
 import com.google.gwt.dev.jjs.ast.JMethodBody;
 import com.google.gwt.dev.jjs.ast.JProgram;
-import com.google.gwt.dev.util.arg.SourceLevel;
 
 /**
  * Tests that {@link com.google.gwt.dev.jjs.impl.GwtAstBuilder} correctly builds the AST for
@@ -30,7 +29,6 @@
 
   @Override
   public void setUp() throws Exception {
-    sourceLevel = SourceLevel.JAVA9;
     super.setUp();
     addAll(
         JavaResourceBase.createMockJavaResource("test.InterfaceWithPrivateMethods",
diff --git a/dev/core/test/com/google/gwt/dev/jjs/impl/JsInteropRestrictionCheckerTest.java b/dev/core/test/com/google/gwt/dev/jjs/impl/JsInteropRestrictionCheckerTest.java
index 9b8e8e7..1eb65dd 100644
--- a/dev/core/test/com/google/gwt/dev/jjs/impl/JsInteropRestrictionCheckerTest.java
+++ b/dev/core/test/com/google/gwt/dev/jjs/impl/JsInteropRestrictionCheckerTest.java
@@ -20,16 +20,11 @@
 import com.google.gwt.dev.javac.testing.impl.MockJavaResource;
 import com.google.gwt.dev.jjs.ast.JMethod;
 import com.google.gwt.dev.jjs.ast.JProgram;
-import com.google.gwt.dev.util.arg.SourceLevel;
 
 /**
  * Tests for the JsInteropRestrictionChecker.
  */
 public class JsInteropRestrictionCheckerTest extends OptimizerTestBase {
-  @Override
-  public void setUp() {
-    sourceLevel = SourceLevel.JAVA9;
-  }
 
   // TODO: eventually test this for default methods in Java 8.
   public void testCollidingAccidentalOverrideConcreteMethodFails() throws Exception {
diff --git a/dev/core/test/com/google/gwt/dev/jjs/impl/PrunerTest.java b/dev/core/test/com/google/gwt/dev/jjs/impl/PrunerTest.java
index d4c61ff..babed2c 100644
--- a/dev/core/test/com/google/gwt/dev/jjs/impl/PrunerTest.java
+++ b/dev/core/test/com/google/gwt/dev/jjs/impl/PrunerTest.java
@@ -19,7 +19,6 @@
 import com.google.gwt.dev.jjs.ast.JMethod;
 import com.google.gwt.dev.jjs.ast.JProgram;
 import com.google.gwt.dev.jjs.ast.js.JsniMethodBody;
-import com.google.gwt.dev.util.arg.SourceLevel;
 
 /**
  * Test for {@link Pruner}.
@@ -27,7 +26,6 @@
 public class PrunerTest extends OptimizerTestBase {
   @Override
   protected void setUp() throws Exception {
-    sourceLevel = SourceLevel.JAVA9;
     super.setUp();
     runDeadCodeElimination = true;
   }
diff --git a/dev/core/test/com/google/gwt/dev/jjs/impl/UnifyAstTest.java b/dev/core/test/com/google/gwt/dev/jjs/impl/UnifyAstTest.java
index 48f324d..2b27c4d 100644
--- a/dev/core/test/com/google/gwt/dev/jjs/impl/UnifyAstTest.java
+++ b/dev/core/test/com/google/gwt/dev/jjs/impl/UnifyAstTest.java
@@ -23,19 +23,12 @@
 import com.google.gwt.dev.jjs.ast.JDeclaredType;
 import com.google.gwt.dev.jjs.ast.JMethod;
 import com.google.gwt.dev.jjs.ast.JProgram;
-import com.google.gwt.dev.util.arg.SourceLevel;
 
 /**
  * Test for {@link UnifyAst}.
  */
 public class UnifyAstTest extends OptimizerTestBase {
 
-  @Override
-  protected void setUp() throws Exception {
-    super.setUp();
-    sourceLevel = SourceLevel.JAVA9;
-  }
-
   public void testPackageInfo_defaultPackagePresent() throws Exception {
     final MockJavaResource packageInfo =
         JavaResourceBase.createMockJavaResource("package-info");
diff --git a/eclipse/dev/.classpath b/eclipse/dev/.classpath
index 0dc189e..c7b2745 100644
--- a/eclipse/dev/.classpath
+++ b/eclipse/dev/.classpath
@@ -6,12 +6,12 @@
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="var" path="GWT_TOOLS/lib/apache/ant-1.6.5.jar" sourcepath="/GWT_TOOLS/lib/apache/ant-1.6.5-src.zip"/>
 	<classpathentry kind="var" path="GWT_TOOLS/lib/apache/tapestry-util-text-4.0.2.jar" sourcepath="/GWT_TOOLS/lib/apache/tapestry-util-text-4.0.2-src.zip"/>
-	<classpathentry kind="var" path="GWT_TOOLS/lib/eclipse/org.eclipse.jdt.core_3.13.100-CUSTOM-GWT-20180108.jar" sourcepath="/GWT_TOOLS/lib/eclipse/org.eclipse.jdt.core.source_3.13.100-CUSTOM-GWT-20180108.jar"/>
-	<classpathentry kind="var" path="GWT_TOOLS/lib/eclipse/jdtCompilerAdapter_3.13.100-CUSTOM-GWT-20180108.jar"/>
+	<classpathentry kind="var" path="GWT_TOOLS/lib/eclipse/org.eclipse.jdt.core_3.13.102-CUSTOM-GWT-20180415.jar" sourcepath="/GWT_TOOLS/lib/eclipse/org.eclipse.jdt.core.source_3.13.102-CUSTOM-GWT-20180415.jar"/>
+	<classpathentry kind="var" path="GWT_TOOLS/lib/eclipse/jdtCompilerAdapter_3.13.102-CUSTOM-GWT-20180415.jar"/>
 	<classpathentry exported="true" kind="var" path="GWT_TOOLS/lib/jetty/jetty-9.2.14.v20151106/jetty-all-9.2.14.v20151106.jar"/>
 	<classpathentry kind="var" path="GWT_TOOLS/lib/jsr305/jsr305.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 kind="var" path="GWT_TOOLS/lib/objectweb/asm-5.0.3/lib/asm-all-5.0.3.jar"/>
+	<classpathentry kind="var" path="GWT_TOOLS/lib/objectweb/asm-6.1.1/asm-6.1.1.jar"/>
 	<classpathentry kind="var" path="GWT_TOOLS/lib/tomcat/ant-launcher-1.6.5.jar"/>
 	<classpathentry kind="var" path="GWT_TOOLS/lib/tomcat/catalina-1.0.jar"/>
 	<classpathentry kind="var" path="GWT_TOOLS/lib/tomcat/catalina-optional-1.0.jar"/>
@@ -30,5 +30,10 @@
 	<classpathentry exported="true" kind="var" path="GWT_TOOLS/lib/tomcat/tomcat-websocket-api-8.0.28.jar"/>
 	<classpathentry exported="true" kind="var" path="GWT_TOOLS/lib/tomcat/tomcat-annotations-api-8.0.28.jar"/>
 	<classpathentry kind="var" path="GWT_TOOLS/lib/colt/colt-1.2.jar" sourcepath="/GWT_TOOLS/lib/colt/colt-1.2-src.jar"/>
+	<classpathentry kind="var" path="GWT_TOOLS/lib/objectweb/asm-6.1.1/asm-analysis-6.1.1.jar"/>
+	<classpathentry kind="var" path="GWT_TOOLS/lib/objectweb/asm-6.1.1/asm-commons-6.1.1.jar"/>
+	<classpathentry kind="var" path="GWT_TOOLS/lib/objectweb/asm-6.1.1/asm-tree-6.1.1.jar"/>
+	<classpathentry kind="var" path="GWT_TOOLS/lib/objectweb/asm-6.1.1/asm-util-6.1.1.jar"/>
+	<classpathentry kind="var" path="GWT_TOOLS/lib/objectweb/asm-6.1.1/asm-xml-6.1.1.jar"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>
diff --git a/eclipse/user/.classpath b/eclipse/user/.classpath
index 15cdf61..9f7b4c6 100644
--- a/eclipse/user/.classpath
+++ b/eclipse/user/.classpath
@@ -33,7 +33,6 @@
 	<classpathentry kind="var" path="GWT_TOOLS/lib/w3c/flute/flute-1.3-gg2.jar"/>
 	<classpathentry kind="var" path="GWT_TOOLS/lib/cglib/cglib-3.1.jar"/>
 	<classpathentry kind="var" path="GWT_TOOLS/lib/objenesis/objenesis-1.2.jar"/>
-	<classpathentry kind="var" path="GWT_TOOLS/lib/objectweb/asm-5.0.3/lib/asm-all-5.0.3.jar"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/gwt-dev"/>
 	<classpathentry kind="var" path="GWT_TOOLS/lib/htmlunit/htmlunit-2.19/htmlunit-2.19.jar"/>
 	<classpathentry kind="var" path="GWT_TOOLS/lib/htmlunit/htmlunit-2.19/htmlunit-core-js-2.15.jar"/>
@@ -62,7 +61,10 @@
 	<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/20160315/sourcemap-rebased.jar"/>
-	<classpathentry kind="var" path="GWT_TOOLS/lib/eclipse/org.eclipse.jdt.core_3.13.100-CUSTOM-GWT-20180108.jar"/>
-	<classpathentry kind="var" path="GWT_TOOLS/lib/eclipse/jdtCompilerAdapter_3.13.100-CUSTOM-GWT-20180108.jar"/>
+	<classpathentry kind="var" path="GWT_TOOLS/lib/eclipse/org.eclipse.jdt.core_3.13.102-CUSTOM-GWT-20180415.jar"/>
+	<classpathentry kind="var" path="GWT_TOOLS/lib/eclipse/jdtCompilerAdapter_3.13.102-CUSTOM-GWT-20180415.jar"/>
+	<classpathentry kind="var" path="GWT_TOOLS/lib/objectweb/asm-6.0/asm-6.0.jar"/>
+	<classpathentry kind="var" path="GWT_TOOLS/lib/objectweb/asm-6.0/asm-analysis-6.0.jar"/>
+	<classpathentry kind="var" path="GWT_TOOLS/lib/objectweb/asm-6.0/asm-commons-6.0.jar"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>
diff --git a/user/build.xml b/user/build.xml
index db141ff..a34b287 100755
--- a/user/build.xml
+++ b/user/build.xml
@@ -65,9 +65,9 @@
     <pathelement location="${gwt.tools.lib}/cglib/cglib-3.1.jar"/>
     <pathelement location="${gwt.tools.lib}/mockito/1.9.5/mockito-all-1.9.5.jar"/>
     <pathelement location="${gwt.tools.lib}/objenesis/objenesis-1.2.jar"/>
-    <pathelement location="${gwt.tools.lib}/objectweb/asm-6.0/asm-6.0.jar"/>
-    <pathelement location="${gwt.tools.lib}/objectweb/asm-6.0/asm-commons-6.0.jar"/>
-    <pathelement location="${gwt.tools.lib}/objectweb/asm-6.0/asm-util-6.0.jar"/>
+    <pathelement location="${gwt.tools.lib}/objectweb/asm-6.1.1/asm-6.1.1.jar"/>
+    <pathelement location="${gwt.tools.lib}/objectweb/asm-6.1.1/asm-commons-6.1.1.jar"/>
+    <pathelement location="${gwt.tools.lib}/objectweb/asm-6.1.1/asm-util-6.1.1.jar"/>
     <pathelement location="${gwt.tools.lib}/javax/validation/validation-api-1.0.0.GA.jar"/>
     <pathelement location="${gwt.tools.lib}/javax/validation/validation-api-1.0.0.GA-sources.jar"/>
     <pathelement
diff --git a/user/test-super/com/google/gwt/dev/jjs/super/com/google/gwt/dev/jjs/test/Java10Test.java b/user/test-super/com/google/gwt/dev/jjs/super/com/google/gwt/dev/jjs/test/Java10Test.java
new file mode 100644
index 0000000..295da17
--- /dev/null
+++ b/user/test-super/com/google/gwt/dev/jjs/super/com/google/gwt/dev/jjs/test/Java10Test.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2018 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
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.dev.jjs.test;
+
+import com.google.gwt.core.client.GwtScriptOnly;
+import com.google.gwt.junit.client.GWTTestCase;
+
+import java.util.ArrayList;
+import java.util.function.Supplier;
+
+/**
+ * Tests Java 10 features. It is super sourced so that gwt can be compiles under Java 7.
+ *
+ * IMPORTANT: For each test here there must exist the corresponding method in the non super sourced
+ * version.
+ *
+ * Eventually this test will graduate and not be super sourced.
+ */
+@GwtScriptOnly
+public class Java10Test extends GWTTestCase {
+
+  interface VarArgsFunction<T, R> {
+    R apply(T... args);
+  }
+
+  @Override
+  public String getModuleName() {
+    return "com.google.gwt.dev.jjs.Java10Test";
+  }
+
+  public void testLocalVarType_DenotableTypes() {
+    var i = 42;
+    assertEquals(42, i);
+    var s = "42";
+    assertEquals("42", s);
+
+    Supplier<String> initializer = () -> "37";
+    var s2 = initializer.get();
+    //to be sure that s2 was inferred as a string and not an Object
+    String s3 = s2;
+    assertEquals("37", s3);
+  }
+
+  public void testLocalVarType_Anonymous() {
+    var o = new Object() {
+      int i;
+      String s;
+    };
+    o.i = 42;
+    o.s = "42";
+    assertEquals(42, o.i);
+    assertEquals("42", o.s);
+  }
+
+  public void testLocalVarType_LambdaCapture() {
+    var s = "42";
+    Supplier<String> supplier = () -> s;
+    assertEquals("42", supplier.get());
+  }
+
+  public void testLocalVarType_VarArg() {
+    var args = new String[] {"4", "2"};
+    VarArgsFunction<String, String> f = arr -> arr[0] + arr[1];
+    assertEquals("42", f.apply(args));
+  }
+
+  public void testLocalVarType_LocalClass() {
+    var i = 37;
+    class Local {
+      int m() {
+        var i = 40;
+        return i + 2;
+      }
+
+      int fromOuterScope() {
+        return i;
+      }
+    }
+
+    var l = new Local();
+    assertEquals(37, l.fromOuterScope());
+    assertEquals(42, l.m());
+  }
+
+  public void testLocalVarType_ForLoop() {
+    var a = new String[] {"4", "2"};
+    var s = "";
+    for (var i = 0; i < a.length; i++) {
+      s += a[i];
+    }
+    assertEquals("42", s);
+  }
+
+  public void testLocalVarType_EnhancedForLoopArray() {
+    var a = new String[] {"4", "2"};
+    var str = "";
+    for (var s : a) {
+      str += s;
+    }
+    assertEquals("42", str);
+  }
+
+  public void testLocalVarType_EnhancedNestedForLoopArray() {
+    var m = new int[][] {{1, 2}, {3, 4}};
+    var summ = 0;
+    for (var row : m) {
+      for (var cell : row) {
+        summ += cell;
+      }
+    }
+    assertEquals(10, summ);
+  }
+
+  public void testLocalVarType_EnhancedForLoopIterable() {
+    var list = new ArrayList<String>();
+    list.add("4");
+    list.add("2");
+    var str = "";
+    for (var s : list) {
+      str += s;
+    }
+    assertEquals("42", str);
+  }
+}
diff --git a/user/test/com/google/gwt/dev/jjs/CompilerSuite.java b/user/test/com/google/gwt/dev/jjs/CompilerSuite.java
index 55f0681..3bd801e 100644
--- a/user/test/com/google/gwt/dev/jjs/CompilerSuite.java
+++ b/user/test/com/google/gwt/dev/jjs/CompilerSuite.java
@@ -27,6 +27,7 @@
 import com.google.gwt.dev.jjs.test.InitialLoadSequenceTest;
 import com.google.gwt.dev.jjs.test.InnerClassTest;
 import com.google.gwt.dev.jjs.test.InnerOuterSuperTest;
+import com.google.gwt.dev.jjs.test.Java10Test;
 import com.google.gwt.dev.jjs.test.Java7Test;
 import com.google.gwt.dev.jjs.test.Java8Test;
 import com.google.gwt.dev.jjs.test.JavaAccessFromJavaScriptTest;
@@ -71,6 +72,7 @@
     // Java8Test cannot be the first one in a suite. It uses a hack
     // to avoid executing if not in a Java 8+ environment.
     suite.addTestSuite(Java8Test.class);
+    suite.addTestSuite(Java10Test.class);
     suite.addTestSuite(JavaAccessFromJavaScriptTest.class);
     suite.addTestSuite(JsniConstructorTest.class);
     suite.addTestSuite(JsniDispatchTest.class);
diff --git a/user/test/com/google/gwt/dev/jjs/Java10Test.gwt.xml b/user/test/com/google/gwt/dev/jjs/Java10Test.gwt.xml
new file mode 100644
index 0000000..f16a361
--- /dev/null
+++ b/user/test/com/google/gwt/dev/jjs/Java10Test.gwt.xml
@@ -0,0 +1,19 @@
+<!--                                                                        -->
+<!-- Copyright 2018 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   -->
+<!-- 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. License for the specific language governing permissions and   -->
+<!-- limitations under the License.                                         -->
+
+<!-- Contains tests for breaking out of the client source path  -->
+<module>
+  <inherits name="com.google.gwt.core.Core" />
+  <super-source path='super' />
+</module>
\ No newline at end of file
diff --git a/user/test/com/google/gwt/dev/jjs/test/Java10Test.java b/user/test/com/google/gwt/dev/jjs/test/Java10Test.java
new file mode 100644
index 0000000..1f22f3c
--- /dev/null
+++ b/user/test/com/google/gwt/dev/jjs/test/Java10Test.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2018 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
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.dev.jjs.test;
+
+import com.google.gwt.dev.util.arg.SourceLevel;
+import com.google.gwt.junit.DoNotRunWith;
+import com.google.gwt.junit.JUnitShell;
+import com.google.gwt.junit.Platform;
+import com.google.gwt.junit.client.GWTTestCase;
+
+/**
+ * Dummy test case. Java10Test is super sourced so that GWT can be compiled by Java 8.
+ *
+ * NOTE: Make sure this class has the same test methods of its supersourced variant.
+ */
+@DoNotRunWith(Platform.Devel)
+public class Java10Test extends GWTTestCase {
+
+  @Override
+  public String getModuleName() {
+    return "com.google.gwt.dev.jjs.Java10Test";
+  }
+
+  @Override
+  public void runTest() throws Throwable {
+    // Only run these tests if -sourceLevel 10 (or greater) is enabled.
+    if (isGwtSourceLevel10()) {
+      super.runTest();
+    }
+  }
+
+  public void testLocalVarType_DenotableTypes() {
+    assertFalse(isGwtSourceLevel10());
+  }
+
+  public void testLocalVarType_Anonymous() {
+    assertFalse(isGwtSourceLevel10());
+  }
+
+  public void testLocalVarType_LambdaCapture() {
+    assertFalse(isGwtSourceLevel10());
+  }
+
+  public void testLocalVarType_VarArg() {
+    assertFalse(isGwtSourceLevel10());
+  }
+
+  public void testLocalVarType_LocalClass() {
+    assertFalse(isGwtSourceLevel10());
+  }
+
+  public void testLocalVarType_ForLoop() {
+    assertFalse(isGwtSourceLevel10());
+  }
+
+  public void testLocalVarType_EnhancedForLoopArray() {
+    assertFalse(isGwtSourceLevel10());
+  }
+
+  public void testLocalVarType_EnhancedNestedForLoopArray() {
+    assertFalse(isGwtSourceLevel10());
+  }
+
+  public void testLocalVarType_EnhancedForLoopIterable() {
+    assertFalse(isGwtSourceLevel10());
+  }
+
+  private boolean isGwtSourceLevel10() {
+    return JUnitShell.getCompilerOptions().getSourceLevel().compareTo(SourceLevel.JAVA10) >= 0;
+  }
+}