Drop support for building or running on Java 7.

This patch does some initial work of adding support for building GWT
on Java >8, but until the javadoc wiring is rebuilt (or conditionally
disabled) a normal build won't be possible.

After Javadoc has been updated or guarded behind a flag, isJava8 can be
false when Java >8 JDK is used to build, and tests for those can be
guarded as makes sense.

The error-prone Java compiler is also temporarily disabled in this
commit, and will be restored and updated to latest in a follow-up patch.

Bug: 9683
Bug-Link: https://github.com/gwtproject/gwt/issues/9683
Change-Id: I5ec65e330409802368b2a60148d7ef1ee97c03d1
diff --git a/common.ant.xml b/common.ant.xml
index b77ea2a..9c19fa8 100755
--- a/common.ant.xml
+++ b/common.ant.xml
@@ -27,11 +27,12 @@
         message="This build file is in an inconsistent state (${ant.file} != ${test.ant.file})."/>
 
   <!-- Global Properties -->
-  <condition property="isJava8">
-    <not>
-      <equals arg1="${ant.java.version}" arg2="1.7" />
-    </not>
-  </condition>
+  <!--
+  Now that Java8 is the baseline, this property indicates that the build should target the
+  baseline, excluding 11+ tests, etc. This is temporary, to remove Java7 support, but not yet
+  remove the various places that version may matter, while Java 9+ support is pending.
+  -->
+  <property name="isJava8" value="true" />
   <property environment="env"/>
   <condition property="gwt.version" value="${env.GWT_VERSION}" else="0.0.0">
     <isset property="env.GWT_VERSION"/>
@@ -61,15 +62,10 @@
   <property name="javac.debug" value="true"/>
   <property name="javac.debuglevel" value="lines,vars,source"/>
   <property name="javac.encoding" value="utf-8"/>
-  <property name="javac.source" value="1.7"/>
-  <property name="javac.target" value="1.7"/>
+  <property name="javac.source" value="8"/>
+  <property name="javac.target" value="8"/>
   <property name="javac.nowarn" value="true"/>
-  <condition property="javac.fork" value="true" else="false">
-    <isfalse value="${isJava8}"/>
-  </condition>
-  <condition property="javac.compiler" value="modern" else="com.google.errorprone.ErrorProneAntCompilerAdapter">
-    <isfalse value="${isJava8}"/>
-  </condition>
+
   <property name="junit.out" location="${project.build}/test"/>
   <property name="emma.dir" value="${gwt.tools.redist}/emma"/>
   <property name="emma.filter.exclude" value=""/>
@@ -155,10 +151,7 @@
     <javac srcdir="src" destdir="${javac.out}" debug="${javac.debug}"
            debuglevel="${javac.debuglevel}" source="${javac.source}" target="${javac.target}"
            nowarn="${javac.nowarn}" encoding="${javac.encoding}"
-           includeantruntime="false" fork="${javac.fork}" compiler="${javac.compiler}">
-      <compilerclasspath if:true="${isJava8}">
-        <pathelement location="${gwt.tools.lib}/errorprone/error_prone_ant-2.0.19.jar"/>
-      </compilerclasspath>
+           includeantruntime="false" fork="true" compiler="modern">
     </javac>
   </presetdef>
 
diff --git a/user/build.xml b/user/build.xml
index 0ca16d6..615ea77 100755
--- a/user/build.xml
+++ b/user/build.xml
@@ -15,16 +15,18 @@
   <property name="emma.merged.out" value="${junit.out}/emma-coverage"/>
 
   <property name="gwt.junit.testcase.web.includes" value="${gwt.junit.testcase.includes}"/>
+  <!-- TODO once we compile with Java >8, update this to exclude tests based on running JDK version -->
   <condition property="gwt.junit.testcase.web.excludes"
             value="**/*JreSuite.class,**/OptimizedOnly*,**/*Java8Suite.class"
-            else="**/*JreSuite.class,**/OptimizedOnly*">
+            else="**/*JreSuite.class,**/OptimizedOnly*,**/*Java8Suite.class">
     <isfalse value="${isJava8}" />
   </condition>
 
   <property name="gwt.junit.testcase.dev.includes" value="${gwt.junit.testcase.includes}"/>
+  <!-- TODO once we compile with Java >8, update this to exclude tests based on running JDK version -->
   <condition property="gwt.junit.testcase.dev.excludes"
             value="**/EmulSuite.class,**/JSONSuite.class,**/RunAsyncSuite.class,**/*CompilerSuite.class,**/*JsInteropSuite.class,**/*JreSuite.class,**/OptimizedOnly*,**/*Java8Suite.class"
-            else="**/EmulSuite.class,**/JSONSuite.class,**/RunAsyncSuite.class,**/*CompilerSuite.class,**/*JsInteropSuite.class,**/*JreSuite.class,**/OptimizedOnly*">
+            else="**/EmulSuite.class,**/JSONSuite.class,**/RunAsyncSuite.class,**/*CompilerSuite.class,**/*JsInteropSuite.class,**/*JreSuite.class,**/OptimizedOnly*,**/*Java8Suite.class">
     <isfalse value="${isJava8}" />
   </condition>
 
@@ -146,15 +148,14 @@
       Compiles the test code for this project
   -->
   <target name="compile.tests"
-          depends="-compile.tests.java7, -compile.tests.java8"
+          depends="-compile.tests.java8"
           unless="compile.tests.complete">
   </target>
 
-  <target name="-compile.tests.java7"
-          depends="compile.dev.tests, compile.emma.if.enabled">
+  <target name="-compile.tests.java8" if="isJava8" depends="compile.dev.tests, compile.emma.if.enabled">
     <mkdir dir="${javac.junit.out}"/>
     <gwt.javac srcdir="test" destdir="${javac.junit.out}"
-               excludes="com/google/gwt/langtest/**,**/super/**,**/java8/**,**/*Java8Suite.java">
+               excludes="com/google/gwt/langtest/**,**/super/**">
       <compilerarg value="-Xep:MissingCasesInEnumSwitch:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
       <compilerarg value="-Xep:SelfComparison:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
       <compilerarg value="-Xep:SelfEquals:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
@@ -176,25 +177,6 @@
     </gwt.javac>
   </target>
 
-  <target name="-compile.tests.java8" if="isJava8" depends="-compile.tests.java7">
-    <gwt.javac srcdir="test" destdir="${javac.junit.out}" source="1.8" target="1.8"
-               includes="**/java8/**,**/*Java8Suite.java">
-      <compilerarg value="-Xep:MissingCasesInEnumSwitch:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
-      <compilerarg value="-Xep:SelfComparison:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
-      <compilerarg value="-Xep:SelfEquals:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
-      <compilerarg value="-Xep:FallThrough:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
-      <compilerarg value="-Xep:ReturnValueIgnored:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
-      <compilerarg value="-Xep:EqualsIncompatibleType:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
-      <classpath>
-        <pathelement location="${javac.junit.out}"/>
-        <pathelement location="${javac.out}"/>
-        <pathelement location="${gwt.tools.lib}/junit/junit-4.8.2.jar"/>
-        <pathelement location="${gwt.tools.lib}/selenium/selenium-java-client-driver.jar"/>
-        <path refid="test.extraclasspath"/>
-      </classpath>
-    </gwt.javac>
-  </target>
-
   <target name="build" depends="compile"
           description="Build and package this project">
     <mkdir dir="${gwt.build.lib}"/>