Do not use the ClassLoader to retrieve the class path.

This is in preparation to supporting Java 9, which does not
necessarily provide an UrlClassLoader. Instead just use
the system property.

Change-Id: I57f40873dba3ca49fc13d0f8e0dc046459376226
diff --git a/dev/core/src/com/google/gwt/dev/cfg/ResourceLoaders.java b/dev/core/src/com/google/gwt/dev/cfg/ResourceLoaders.java
index 746082d..987e1d9 100644
--- a/dev/core/src/com/google/gwt/dev/cfg/ResourceLoaders.java
+++ b/dev/core/src/com/google/gwt/dev/cfg/ResourceLoaders.java
@@ -15,12 +15,15 @@
  */
 package com.google.gwt.dev.cfg;
 
+import static com.google.gwt.thirdparty.guava.common.base.StandardSystemProperty.JAVA_CLASS_PATH;
+
+import com.google.gwt.thirdparty.guava.common.base.Splitter;
+
 import java.io.File;
 import java.net.MalformedURLException;
 import java.net.URL;
-import java.net.URLClassLoader;
+import java.nio.file.Paths;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 
 /**
@@ -32,6 +35,8 @@
     private final ClassLoader wrapped;
 
     public ClassLoaderAdapter(ClassLoader wrapped) {
+      // TODO(rluble): Maybe stop wrapping arbitrary class loaders here and always use the
+      // system ClassLoader.
       this.wrapped = wrapped;
     }
 
@@ -45,15 +50,15 @@
     }
 
     /**
-     * Returns the URLs of the wrapped ClassLoader and each parent that's a URLClassLoader.
+     * Returns the URLs for the system class path.
      */
     @Override
     public List<URL> getClassPath() {
       List<URL> result = new ArrayList<URL>();
-      for (ClassLoader candidate = wrapped; candidate != null; candidate = candidate.getParent()) {
-        if (candidate instanceof URLClassLoader) {
-          URL[] urls = ((URLClassLoader) candidate).getURLs();
-          result.addAll(Arrays.asList(urls));
+      for (String entry : Splitter.on(File.pathSeparatorChar).split(JAVA_CLASS_PATH.value())) {
+        try {
+          result.add(Paths.get(entry).toUri().toURL());
+        } catch (MalformedURLException e) {
         }
       }
       return result;