Remove JreIndex from JdtCompiler.

This is in preparation for Java 9. Keeping track of JRE packages
has not been necessary for a long time, rendering JreIndex unnecessary.
JreIndex used the system ClassLoader to identify JRE package names
assuming it was an UrlClassLoader which is no longer the case in Java 9.

Change-Id: Ie826b8cedf60dee13cb31fb6171efb2976b1dfc3
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 0c13e7e..4f2ffdd 100644
--- a/dev/core/src/com/google/gwt/dev/javac/JdtCompiler.java
+++ b/dev/core/src/com/google/gwt/dev/javac/JdtCompiler.java
@@ -19,7 +19,6 @@
 import com.google.gwt.core.ext.UnableToCompleteException;
 import com.google.gwt.dev.CompilerContext;
 import com.google.gwt.dev.jdt.TypeRefVisitor;
-import com.google.gwt.dev.jjs.InternalCompilerException;
 import com.google.gwt.dev.jjs.ast.JDeclaredType;
 import com.google.gwt.dev.util.arg.SourceLevel;
 import com.google.gwt.dev.util.collect.Lists;
@@ -78,14 +77,12 @@
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
-import java.net.JarURLConnection;
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.LinkedHashMap;
@@ -93,8 +90,6 @@
 import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
 
 /**
  * Manages the process of compiling {@link CompilationUnit}s.
@@ -149,49 +144,6 @@
       results.add(builder.build());
     }
   }
-  /**
-   * Static cache of all the JRE package names.
-   */
-  public static class JreIndex {
-    private static Set<String> packages = readPackages();
-
-    public static boolean contains(String name) {
-      return packages.contains(name);
-    }
-
-    private static void addPackageRecursively(Set<String> packages, String pkg) {
-      if (!packages.add(pkg)) {
-        return;
-      }
-
-      int i = pkg.lastIndexOf('/');
-      if (i != -1) {
-        addPackageRecursively(packages, pkg.substring(0, i));
-      }
-    }
-
-    private static Set<String> readPackages() {
-      HashSet<String> pkgs = new HashSet<String>();
-      String klass = "java/lang/Object.class";
-      URL url = ClassLoader.getSystemClassLoader().getResource(klass);
-      try {
-        JarURLConnection connection = (JarURLConnection) url.openConnection();
-        JarFile f = connection.getJarFile();
-        Enumeration<JarEntry> entries = f.entries();
-        while (entries.hasMoreElements()) {
-          JarEntry e = entries.nextElement();
-          String name = e.getName();
-          if (name.endsWith(".class")) {
-            String pkg = Shared.getSlashedPackageFrom(name);
-            addPackageRecursively(pkgs, pkg);
-          }
-        }
-        return pkgs;
-      } catch (IOException e) {
-        throw new InternalCompilerException("Unable to find JRE", e);
-      }
-    }
-  }
 
   /**
    * Interface for processing units on the fly during compilation.
@@ -440,7 +392,7 @@
       String internalName = String.valueOf(internalNameChars);
 
       // If we already know this is a package, take the shortcut.
-      if (JreIndex.contains(internalName) || packages.contains(internalName)) {
+      if (packages.contains(internalName)) {
         return null;
       }
 
@@ -642,10 +594,6 @@
     }
 
     private boolean isPackage(String slashedPackageName) {
-      // Test the JRE explicitly, because the classloader trick doesn't work.
-      if (JreIndex.contains(slashedPackageName)) {
-        return true;
-      }
       /*
        * TODO(zundel): When cached CompiledClass instances are used, 'packages'
        * does not contain all packages in the compile and this test fails the