ordercheck passes.


git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@47 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/util/FileOracleFactory.java b/dev/core/src/com/google/gwt/dev/util/FileOracleFactory.java
index bd1915f..298a0fd 100644
--- a/dev/core/src/com/google/gwt/dev/util/FileOracleFactory.java
+++ b/dev/core/src/com/google/gwt/dev/util/FileOracleFactory.java
@@ -71,6 +71,10 @@
    */
   private static final class FileOracleImpl extends FileOracle {
 
+    private final String[] logicalNames;
+
+    private final Map logicalToPhysical;
+
     /**
      * Creates a new FileOracle.
      * 
@@ -108,9 +112,6 @@
     public boolean isEmpty() {
       return logicalNames.length == 0;
     }
-
-    private final String[] logicalNames;
-    private final Map logicalToPhysical;
   }
 
   /**
@@ -154,7 +155,7 @@
         }
       } catch (IOException e) {
         logger.log(TreeLogger.WARN, "Unexpected error searching classpath for "
-          + curPkg, e);
+            + curPkg, e);
       }
     }
 
@@ -209,7 +210,7 @@
       if (f.exists()) {
         if (f.isDirectory()) {
           indexFolder(logger, filter, stripBaseLen, f, logicalNames,
-            logicalToPhysical);
+              logicalToPhysical);
         } else if (f.isFile()) {
           try {
             String logicalName = f.getAbsolutePath().substring(stripBaseLen);
@@ -217,7 +218,7 @@
             if (logicalToPhysical.containsKey(logicalName)) {
               // this logical name is shadowed
               logger.log(TreeLogger.DEBUG, "Ignoring already-resolved "
-                + logicalName, null);
+                  + logicalName, null);
               continue;
             }
             if (filter != null && !filter.accept(logicalName)) {
@@ -264,7 +265,7 @@
         if (logicalToPhysical.containsKey(logicalName)) {
           // this logical name is shadowed
           logger.log(TreeLogger.DEBUG, "Ignoring already-resolved "
-            + logicalName, null);
+              + logicalName, null);
           continue;
         }
         if (filter != null && !filter.accept(logicalName)) {
@@ -279,7 +280,7 @@
           logger.log(TreeLogger.TRACE, "Found " + logicalName, null);
         } catch (MalformedURLException e) {
           logger.log(TreeLogger.WARN, "Unexpected error resolving "
-            + physicalUrlString, e);
+              + physicalUrlString, e);
         }
       }
     }
@@ -308,15 +309,15 @@
       File f = new File(uri);
       if (f.isDirectory()) {
         int prefixCharsToStrip = f.getAbsolutePath().length() + 1
-          - pkgBase.length();
+            - pkgBase.length();
         indexFolder(logger, filter, prefixCharsToStrip, f, logicalNames,
-          logicalToPhysical);
+            logicalToPhysical);
       } else {
         // We can't handle files here, only directories. If this is a jar
         // reference, the url must come in as a "jar:file:<stuff>!/[stuff/]".
         // Fall through.
         logger.log(TreeLogger.WARN, "Unexpected error, " + f
-          + " is neither a file nor a jar", null);
+            + " is neither a file nor a jar", null);
       }
     } else if (url.getProtocol().equals("jar")) {
       String path = url.getPath();
@@ -333,10 +334,10 @@
           // determining the logical name (sans the pkgBase name we want!)
           //
           indexJar(logger, filter, "jar:" + jarPath, jarFile, dirPath, pkgBase,
-            logicalNames, logicalToPhysical);
+              logicalNames, logicalToPhysical);
         } else {
           logger.log(TreeLogger.WARN, "Unexpected error, jar at " + jarURL
-            + " must be a file: type URL", null);
+              + " must be a file: type URL", null);
         }
       } else {
         throw new URISyntaxException(path, "Cannot locate '!' separator");
@@ -347,6 +348,23 @@
   }
 
   /**
+   * The underlying classloader.
+   */
+  private final URLClassLoader classLoader;
+
+  /**
+   * A map of packages indexed from the root of the class path onto their
+   * corresponding FileFilters.
+   */
+  private final Map packages = new HashMap();
+
+  /**
+   * A map of packages that become their own roots (that is their children are
+   * indexed relative to them) onto their corresponding FileFilters.
+   */
+  private final Map rootPackages = new HashMap();
+
+  /**
    * Creates a FileOracleFactory with the default URLClassLoader.
    */
   public FileOracleFactory() {
@@ -421,10 +439,10 @@
 
     // don't record package names for root packages, they are rebased
     addPackagesInSortedOrder(logger, classLoader, rootPackages, classPathUrls,
-      urls, pkgNames, filters, false);
+        urls, pkgNames, filters, false);
     // record package names for non-root packages
     addPackagesInSortedOrder(logger, classLoader, packages, classPathUrls,
-      urls, pkgNames, filters, true);
+        urls, pkgNames, filters, true);
 
     // We have a complete sorted list of mapped URLs with package prefixes
 
@@ -438,14 +456,14 @@
         String pkgName = (String) pkgNames.get(i);
         FileFilter filter = (FileFilter) filters.get(i);
         TreeLogger branch = logger.branch(TreeLogger.TRACE, url.toString(),
-          null);
+            null);
         indexURL(branch, filter, url, pkgName, logicalNames, logicalToPhysical);
       } catch (URISyntaxException e) {
         logger.log(TreeLogger.WARN,
-          "Unexpected error searching " + urls.get(i), e);
+            "Unexpected error searching " + urls.get(i), e);
       } catch (IOException e) {
         logger.log(TreeLogger.WARN,
-          "Unexpected error searching " + urls.get(i), e);
+            "Unexpected error searching " + urls.get(i), e);
       }
     }
 
@@ -465,21 +483,4 @@
       return packageAsPath + "/";
     }
   }
-
-  /**
-   * The underlying classloader.
-   */
-  private final URLClassLoader classLoader;
-
-  /**
-   * A map of packages indexed from the root of the class path onto their
-   * corresponding FileFilters.
-   */
-  private final Map packages = new HashMap();
-
-  /**
-   * A map of packages that become their own roots (that is their children are
-   * indexed relative to them) onto their corresponding FileFilters.
-   */
-  private final Map rootPackages = new HashMap();
 }
diff --git a/dev/core/src/com/google/gwt/dev/util/HttpHeaders.java b/dev/core/src/com/google/gwt/dev/util/HttpHeaders.java
index ab286ca..a29ecbb 100644
--- a/dev/core/src/com/google/gwt/dev/util/HttpHeaders.java
+++ b/dev/core/src/com/google/gwt/dev/util/HttpHeaders.java
@@ -46,7 +46,7 @@
   public static final String CACHE_CONTROL_PRIVATE = "private";
   public static final String CACHE_CONTROL_MUST_REVALIDATE = "must-revalidate";
   public static final String CACHE_FOREVER = "max-age="
-    + String.valueOf(90 * MS_DAY);
+      + String.valueOf(90 * MS_DAY);
   public static final String CACHE_MINUTE = "max-age=" + String.valueOf(MS_MIN);
 
   public static final String LAST_MODIFIED = "Last-Modified";
@@ -63,32 +63,22 @@
    * The Internet date format for HTTP.
    */
   private static DateFormat sHttpDateFormat = new SimpleDateFormat(
-    "EEE, d MMM yyyy HH:mm:ss", Locale.US);
+      "EEE, d MMM yyyy HH:mm:ss", Locale.US);
 
   /**
-   * Converts a local date to GMT.
-   * 
-   * @param date the date in the local time zone
-   * @return the GMT version
+   * Converts an HTTP date string into a file-style date/time.
    */
-  private static Date dateToGMT(Date date) {
-    Calendar cal = Calendar.getInstance();
-    long tzMillis = cal.get(Calendar.ZONE_OFFSET)
-      + cal.get(Calendar.DST_OFFSET);
-    return new Date(date.getTime() - tzMillis);
-  }
-
-  /**
-   * Converts a GMT into a local date.
-   * 
-   * @param date the date in GMT
-   * @return the the local time zone version
-   */
-  private static Date gmtToDate(Date date) {
-    Calendar cal = Calendar.getInstance();
-    long tzMillis = cal.get(Calendar.ZONE_OFFSET)
-      + cal.get(Calendar.DST_OFFSET);
-    return new Date(date.getTime() + tzMillis);
+  public static long fromInternetDateFormat(String timeStr) {
+    Date dateGmt;
+    try {
+      synchronized (sHttpDateFormat) {
+        dateGmt = sHttpDateFormat.parse(timeStr);
+      }
+    } catch (ParseException e) {
+      return 0;
+    }
+    dateGmt = gmtToDate(dateGmt);
+    return dateGmt.getTime();
   }
 
   /**
@@ -105,18 +95,28 @@
   }
 
   /**
-   * Converts an HTTP date string into a file-style date/time.
+   * Converts a local date to GMT.
+   * 
+   * @param date the date in the local time zone
+   * @return the GMT version
    */
-  public static long fromInternetDateFormat(String timeStr) {
-    Date dateGmt;
-    try {
-      synchronized (sHttpDateFormat) {
-        dateGmt = sHttpDateFormat.parse(timeStr);
-      }
-    } catch (ParseException e) {
-      return 0;
-    }
-    dateGmt = gmtToDate(dateGmt);
-    return dateGmt.getTime();
+  private static Date dateToGMT(Date date) {
+    Calendar cal = Calendar.getInstance();
+    long tzMillis = cal.get(Calendar.ZONE_OFFSET)
+        + cal.get(Calendar.DST_OFFSET);
+    return new Date(date.getTime() - tzMillis);
+  }
+
+  /**
+   * Converts a GMT into a local date.
+   * 
+   * @param date the date in GMT
+   * @return the the local time zone version
+   */
+  private static Date gmtToDate(Date date) {
+    Calendar cal = Calendar.getInstance();
+    long tzMillis = cal.get(Calendar.ZONE_OFFSET)
+        + cal.get(Calendar.DST_OFFSET);
+    return new Date(date.getTime() + tzMillis);
   }
 }
diff --git a/dev/core/src/com/google/gwt/dev/util/Jsni.java b/dev/core/src/com/google/gwt/dev/util/Jsni.java
index 55006c2..63f9525 100644
--- a/dev/core/src/com/google/gwt/dev/util/Jsni.java
+++ b/dev/core/src/com/google/gwt/dev/util/Jsni.java
@@ -47,16 +47,19 @@
 
   public static class Interval {
 
+    public final int end;
+
+    public final int start;
+
     public Interval(int start, int end) {
       this.start = start;
       this.end = end;
     }
-
-    public final int end;
-    public final int start;
   }
 
   private static class VisitorImpl extends JsSourceGenerationVisitor {
+    private final TextOutput out;
+
     public VisitorImpl(TextOutput out, NamingStrategy namer) {
       super(out, namer);
       this.out = out;
@@ -100,11 +103,9 @@
         return super.visit(x);
       }
     }
-
-    private final TextOutput out;
   }
-  public static final String JAVASCRIPTHOST_NAME = JavaScriptHost.class
-    .getName();
+
+  public static final String JAVASCRIPTHOST_NAME = JavaScriptHost.class.getName();
 
   public static final String JSNI_BLOCK_END = "}-*/";
 
@@ -209,6 +210,16 @@
     return countNewlines(src.toCharArray(), start, end);
   }
 
+  /**
+   * Replaces double-quotes and backslashes in native JS code with their
+   * appropriate escaped form (so they can be encoded in a java string).
+   */
+  public static String escapeQuotesAndSlashes(String str) {
+    StringBuffer buf = new StringBuffer(str);
+    escapeQuotesAndSlashes(buf);
+    return buf.toString();
+  }
+
   public static Interval findJsniSource(JMethod method)
       throws UnableToCompleteException {
     assert (method.isNative());
@@ -324,16 +335,6 @@
    * Replaces double-quotes and backslashes in native JS code with their
    * appropriate escaped form (so they can be encoded in a java string).
    */
-  public static String escapeQuotesAndSlashes(String str) {
-    StringBuffer buf = new StringBuffer(str);
-    escapeQuotesAndSlashes(buf);
-    return buf.toString();
-  }
-
-  /**
-   * Replaces double-quotes and backslashes in native JS code with their
-   * appropriate escaped form (so they can be encoded in a java string).
-   */
   private static void escapeQuotesAndSlashes(StringBuffer buf) {
     for (int i = 0; i < buf.length(); ++i) {
       char c = buf.charAt(i);
diff --git a/dev/core/src/com/google/gwt/dev/util/NetProxy.java b/dev/core/src/com/google/gwt/dev/util/NetProxy.java
index 596b30b..1d3332f 100644
--- a/dev/core/src/com/google/gwt/dev/util/NetProxy.java
+++ b/dev/core/src/com/google/gwt/dev/util/NetProxy.java
@@ -23,198 +23,203 @@
 
 public class NetProxy {
 
-    public static void main(String[] args) {
-        if (args.length < 2) {
-            System.out.println("Usage: NetProxy <local-port> <remote-port> [<remote-host>]");
-            return;
-        }
-
-        int localPort = Integer.parseInt(args[0]);
-        int remotePort = Integer.parseInt(args[1]);
-        String remoteHost = args.length < 3 ? "localhost" : args[2];
-        NetProxy netProxy = new NetProxy(localPort, remoteHost, remotePort, true);
-        netProxy.run();
+  private class ClientToServerProxyConnection extends ProxyConnection {
+    public ClientToServerProxyConnection(Socket clientSideSocket,
+        Socket serverSideSocket) {
+      super(clientSideSocket, serverSideSocket);
+      setName(fromPort + " => " + toPort + " #" + connections);
     }
 
-    private boolean fDumpChars;
-    private int fFromPort;
-    private String fToName;
-    private int fToPort;
-    private int fBytesSent;
-    private int fBytesReceived;
-    private int fConnections;
-    private boolean fEnd;
-    private long fStartTime = System.currentTimeMillis();
+    protected void recordBytesTransferred(byte[] bytes, int avail) {
+      addBytesSent(avail, bytes);
+    }
+  }
 
-    public NetProxy(int fromPort, String toName, int toPort, boolean dumpChars) {
-        fFromPort = fromPort;
-        fToName = toName;
-        fToPort = toPort;
-        fDumpChars = dumpChars;
-    }
-    
-    public void end() {
-        fEnd = true;
-    }
+  private abstract class ProxyConnection extends Thread {
+    private Socket fromSocket;
+    private Socket toSocket;
 
-    protected int getBytesSent() {
-        return fBytesSent;
-    }
-
-    protected int getBytesReceived() {
-        return fBytesReceived;
-    }
-    
-    private synchronized void log(int bytesSent, int bytesReceived, byte[] dataBuffer) {
-        System.out.print(System.currentTimeMillis() - fStartTime);
-        System.out.print("\t");
-        System.out.print(bytesSent);
-        System.out.print("\t");
-        System.out.print(bytesReceived);
-        System.out.print("\t");
-        System.out.print(fBytesSent + fBytesReceived);
-        System.out.print("\t");
-        char ch;
-        int avail = (bytesSent != 0 ? bytesSent : bytesReceived);
-        if (fDumpChars) {
-            int limit = (avail < 1024 ? avail : 1024);
-            for (int i = 0; i < limit; ++i) {
-                ch = (char)dataBuffer[i];
-                if (ch >= 32 && ch < 128) {
-                    System.out.print(ch);
-                } else if (ch == '\n') {
-                    System.out.print("\\n");
-                } else if (ch == '\r') {
-                    System.out.print("\\r");
-                } else {
-                    System.out.print('.');
-                }
-            }
-        } else {
-            // Just read up to the \r\n\r\n.
-            //
-            try {
-                String http = new String(dataBuffer, "UTF-8");
-                int endOfHeaders = http.indexOf("\r\n\r\n");
-                if (endOfHeaders != -1 && http.indexOf("HTTP") != -1) {
-                    http = http.replaceAll("\\r", ""); 
-                    http = http.replaceAll("\\n", "\n\t\t\t\t");
-                    System.out.print(http.substring(0, endOfHeaders));
-                } else {
-                    System.out.print("(data)");
-                }
-            } catch (UnsupportedEncodingException e) {
-                e.printStackTrace();
-            }
-        }
-        
-        System.out.println();
-    }  
-    
-    private synchronized void addBytesSent(int byteCount, byte[] bytes) {
-        fBytesSent += byteCount;
-        log(byteCount, 0, bytes);
-    }
-
-    private synchronized void addBytesReceived(int byteCount, byte[] bytes) {
-        fBytesReceived += byteCount;        
-        log(0, byteCount, bytes);
+    public ProxyConnection(Socket fromSocket, Socket toSocket) {
+      this.fromSocket = fromSocket;
+      this.toSocket = toSocket;
     }
 
     public void run() {
+      try {
+        InputStream fromSideInput = fromSocket.getInputStream();
+        OutputStream toSideOutput = toSocket.getOutputStream();
+
+        /*
+         * Spin and pass data in one direction.
+         */
+        int avail;
+        byte[] bytes = new byte[32768];
+        while (true) {
+          // Read 'from' side
+          avail = fromSideInput.read(bytes);
+          if (avail > 0) {
+            // Forward to 'to' side
+            toSideOutput.write(bytes, 0, avail);
+            // Accumulate bytes received
+            recordBytesTransferred(bytes, avail);
+          } else if (avail == -1) {
+            break;
+          }
+        }
+      } catch (Throwable e) {
+      } finally {
         try {
-            System.out.println("Time\tBytes Sent\tBytes Received\tTotal Bytes\tHTTP Data");
-            ServerSocket serverSocket = new ServerSocket(fFromPort);
-            while (!fEnd) {
-                try {
-                    ++fConnections;
-
-                    /*
-                     * Listen for and accept the client-initiated connection.
-                     * Connect to the real server.
-                     * Spawn a thread to handle the data shuffling for newly-created connection.
-                     */
-                    Socket clientSideSocket = serverSocket.accept();
-                    clientSideSocket.setTcpNoDelay(true);
-
-                    Socket serverSideSocket = new Socket(fToName, fToPort);
-                    serverSideSocket.setTcpNoDelay(true);
-
-                    new ClientToServerProxyConnection(clientSideSocket, serverSideSocket).start();
-                    new ServerToClientProxyConnection(clientSideSocket, serverSideSocket).start();
-                } catch (Throwable e) {
-                    e.printStackTrace();
-                }
-            }
+          fromSocket.close();
+          toSocket.close();
         } catch (Throwable e) {
-            // Failed to even be able to listen.
-            e.printStackTrace();
         }
-    }
-    
-    private abstract class ProxyConnection extends Thread {
-        private Socket fFromSocket;
-        private Socket fToSocket;
-
-        public ProxyConnection(Socket fromSocket, Socket toSocket) {
-            fFromSocket = fromSocket;
-            fToSocket = toSocket;
-        }
-
-        public void run() {
-            try {
-                InputStream fromSideInput = fFromSocket.getInputStream();
-                OutputStream toSideOutput = fToSocket.getOutputStream();
-
-                /*
-                 * Spin and pass data in one direction.
-                 */
-                int avail;
-                byte[] bytes = new byte[32768];
-                while (true) {
-                    // Read 'from' side
-                    avail = fromSideInput.read(bytes); 
-                    if (avail > 0) {
-                        // Forward to 'to' side 
-                        toSideOutput.write(bytes, 0, avail);
-                        // Accumulate bytes received
-                        recordBytesTransferred(bytes, avail);
-                    } else if (avail == -1) {
-                        break;
-                    }
-                }
-            } catch (Throwable e) {
-            } finally {
-                try {
-                    fFromSocket.close();
-                    fToSocket.close();
-                } catch (Throwable e) {
-                }
-            }
-        }
-        
-        protected abstract void recordBytesTransferred(byte[] bytes, int avail);
-    }
-    
-    private class ClientToServerProxyConnection extends ProxyConnection {
-        public ClientToServerProxyConnection(Socket clientSideSocket, Socket serverSideSocket) {
-            super(clientSideSocket, serverSideSocket);
-            setName(fFromPort + " => " + fToPort + " #" + fConnections);
-        }
-        
-        protected void recordBytesTransferred(byte[] bytes, int avail) {
-            addBytesSent(avail, bytes);
-        }
+      }
     }
 
-    private class ServerToClientProxyConnection extends ProxyConnection {
-        public ServerToClientProxyConnection(Socket clientSideSocket, Socket serverSideSocket) {
-            super(serverSideSocket, clientSideSocket);
-            setName(fFromPort + " <= " + fToPort + " #" + fConnections);
-        }
-
-        protected void recordBytesTransferred(byte[] bytes, int avail) {
-            addBytesReceived(avail, bytes);
-        }
+    protected abstract void recordBytesTransferred(byte[] bytes, int avail);
+  }
+  private class ServerToClientProxyConnection extends ProxyConnection {
+    public ServerToClientProxyConnection(Socket clientSideSocket,
+        Socket serverSideSocket) {
+      super(serverSideSocket, clientSideSocket);
+      setName(fromPort + " <= " + toPort + " #" + connections);
     }
+
+    protected void recordBytesTransferred(byte[] bytes, int avail) {
+      addBytesReceived(avail, bytes);
+    }
+  }
+
+  public static void main(String[] args) {
+    if (args.length < 2) {
+      System.out.println("Usage: NetProxy <local-port> <remote-port> [<remote-host>]");
+      return;
+    }
+
+    int localPort = Integer.parseInt(args[0]);
+    int remotePort = Integer.parseInt(args[1]);
+    String remoteHost = args.length < 3 ? "localhost" : args[2];
+    NetProxy netProxy = new NetProxy(localPort, remoteHost, remotePort, true);
+    netProxy.run();
+  }
+
+  private boolean dumpChars;
+  private int fromPort;
+  private String toName;
+  private int toPort;
+  private int bytesSent;
+  private int bytesReceived;
+
+  private int connections;
+
+  private boolean end;
+
+  private long startTime = System.currentTimeMillis();
+
+  public NetProxy(int fromPort, String toName, int toPort, boolean dumpChars) {
+    this.fromPort = fromPort;
+    this.toName = toName;
+    this.toPort = toPort;
+    this.dumpChars = dumpChars;
+  }
+
+  public void end() {
+    end = true;
+  }
+
+  public void run() {
+    try {
+      System.out.println("Time\tBytes Sent\tBytes Received\tTotal Bytes\tHTTP Data");
+      ServerSocket serverSocket = new ServerSocket(fromPort);
+      while (!end) {
+        try {
+          ++connections;
+
+          /*
+           * Listen for and accept the client-initiated connection. Connect to
+           * the real server. Spawn a thread to handle the data shuffling for
+           * newly-created connection.
+           */
+          Socket clientSideSocket = serverSocket.accept();
+          clientSideSocket.setTcpNoDelay(true);
+
+          Socket serverSideSocket = new Socket(toName, toPort);
+          serverSideSocket.setTcpNoDelay(true);
+
+          new ClientToServerProxyConnection(clientSideSocket, serverSideSocket).start();
+          new ServerToClientProxyConnection(clientSideSocket, serverSideSocket).start();
+        } catch (Throwable e) {
+          e.printStackTrace();
+        }
+      }
+    } catch (Throwable e) {
+      // Failed to even be able to listen.
+      e.printStackTrace();
+    }
+  }
+
+  protected int getBytesReceived() {
+    return bytesReceived;
+  }
+
+  protected int getBytesSent() {
+    return bytesSent;
+  }
+
+  private synchronized void addBytesReceived(int byteCount, byte[] bytes) {
+    bytesReceived += byteCount;
+    log(0, byteCount, bytes);
+  }
+
+  private synchronized void addBytesSent(int byteCount, byte[] bytes) {
+    this.bytesSent += byteCount;
+    log(byteCount, 0, bytes);
+  }
+
+  private synchronized void log(int bytesSent, int bytesReceived,
+      byte[] dataBuffer) {
+    System.out.print(System.currentTimeMillis() - startTime);
+    System.out.print("\t");
+    System.out.print(bytesSent);
+    System.out.print("\t");
+    System.out.print(bytesReceived);
+    System.out.print("\t");
+    System.out.print(this.bytesSent + this.bytesReceived);
+    System.out.print("\t");
+    char ch;
+    int avail = (bytesSent != 0 ? bytesSent : bytesReceived);
+    if (dumpChars) {
+      int limit = (avail < 1024 ? avail : 1024);
+      for (int i = 0; i < limit; ++i) {
+        ch = (char) dataBuffer[i];
+        if (ch >= 32 && ch < 128) {
+          System.out.print(ch);
+        } else if (ch == '\n') {
+          System.out.print("\\n");
+        } else if (ch == '\r') {
+          System.out.print("\\r");
+        } else {
+          System.out.print('.');
+        }
+      }
+    } else {
+      // Just read up to the \r\n\r\n.
+      //
+      try {
+        String http = new String(dataBuffer, "UTF-8");
+        int endOfHeaders = http.indexOf("\r\n\r\n");
+        if (endOfHeaders != -1 && http.indexOf("HTTP") != -1) {
+          http = http.replaceAll("\\r", "");
+          http = http.replaceAll("\\n", "\n\t\t\t\t");
+          System.out.print(http.substring(0, endOfHeaders));
+        } else {
+          System.out.print("(data)");
+        }
+      } catch (UnsupportedEncodingException e) {
+        e.printStackTrace();
+      }
+    }
+
+    System.out.println();
+  }
 }
diff --git a/dev/core/src/com/google/gwt/dev/util/SelectionScriptGenerator.java b/dev/core/src/com/google/gwt/dev/util/SelectionScriptGenerator.java
index 6f83480..e293d13 100644
--- a/dev/core/src/com/google/gwt/dev/util/SelectionScriptGenerator.java
+++ b/dev/core/src/com/google/gwt/dev/util/SelectionScriptGenerator.java
@@ -43,6 +43,38 @@
 public class SelectionScriptGenerator {
 
   /**
+   * Maps compilation strong name onto a <code>Set</code> of
+   * <code>String[]</code>. We use a <code>TreeMap</code> to produce the
+   * same generated code for the same set of compilations.
+   */
+  private final Map propertyValuesSetByStrongName = new TreeMap();
+
+  private final Property[] orderedProps;
+
+  private final Properties moduleProps;
+
+  private final String moduleName;
+
+  private final Scripts scripts;
+
+  private final Styles styles;
+
+  /**
+   * A constructor for creating a selection script that will work only in hosted
+   * mode.
+   * 
+   * @param moduleDef the module for which the selection script will be
+   *          generated
+   */
+  public SelectionScriptGenerator(ModuleDef moduleDef) {
+    this.moduleName = moduleDef.getName();
+    this.scripts = moduleDef.getScripts();
+    this.styles = moduleDef.getStyles();
+    this.moduleProps = moduleDef.getProperties();
+    this.orderedProps = null;
+  }
+
+  /**
    * A constructor for creating a selection script that will work in either
    * hosted or web mode.
    * 
@@ -61,21 +93,6 @@
   }
 
   /**
-   * A constructor for creating a selection script that will work only in hosted
-   * mode.
-   * 
-   * @param moduleDef the module for which the selection script will be
-   *          generated
-   */
-  public SelectionScriptGenerator(ModuleDef moduleDef) {
-    this.moduleName = moduleDef.getName();
-    this.scripts = moduleDef.getScripts();
-    this.styles = moduleDef.getStyles();
-    this.moduleProps = moduleDef.getProperties();
-    this.orderedProps = null;
-  }
-
-  /**
    * Generates a selection script based on the current settings.
    * 
    * @return an html document whose contents are the definition of a
@@ -115,89 +132,6 @@
   }
 
   /**
-   * Emits all the script required to set up the module and, in web mode, select
-   * a compilation.
-   * 
-   * @param pw
-   * @return an expression that should be called as the body's onload handler
-   */
-  private String genScript(PrintWriter pw) {
-    // Emit $wnd and $doc for dynamic property providers.
-    pw.println("var $wnd = parent;");
-    pw.println("var $doc = $wnd.document;");
-    pw.println("var $moduleName = null;");
-
-    // Emit property providers; these are used in both modes.
-    genPropProviders(pw);
-
-    // If the ordered props are specified, then we're generating for both modes.
-    if (orderedProps != null) {
-      // Web mode or hosted mode.
-      if (orderedProps.length > 0) {
-        pw.println();
-        genAnswerFunction(pw);
-        pw.println();
-        genSrcSetFunction(pw, null);
-      } else {
-        // Rare case of no properties; happens if you inherit from Core alone.
-        assert (orderedProps.length == 0);
-        Set entrySet = propertyValuesSetByStrongName.entrySet();
-        assert (entrySet.size() == 1);
-        Map.Entry entry = (Entry) entrySet.iterator().next();
-        String strongName = (String) entry.getKey();
-        genSrcSetFunction(pw, strongName);
-      }
-    } else {
-      // Hosted mode only, so there is no strong name selection (i.e. because
-      // there is no compiled JavaScript); do nothing
-    }
-
-    // Emit dynamic file injection logic; same logic is used in both modes.
-    if (hasExternalFiles()) {
-      genInjectExternalFiles(pw);
-    }
-
-    genOnLoad(pw);
-
-    return "onLoad()";
-  }
-
-  private boolean hasExternalFiles() {
-    return !scripts.isEmpty() || !styles.isEmpty();
-  }
-
-  private void genOnLoad(PrintWriter pw) {
-    // Emit the onload() function.
-    pw.println();
-    pw.println("function onLoad() {");
-
-    // Early out (or fall through below) if the page is loaded out of context.
-    pw.println("  if (!$wnd.__gwt_isHosted) return;");
-
-    // Maybe inject scripts.
-    if (hasExternalFiles()) {
-      pw.println("  injectExternalFiles();");
-    }
-
-    // If we're in web mode, run the compilation selector logic.
-    // The compilation will call mcb.compilationLoaded() itself.
-    pw.println("  if (!$wnd.__gwt_isHosted()) {");
-    pw.println("    selectScript();");
-    pw.println("  }");
-
-    // If we're in hosted mode, notify $wnd that we're ready to go.
-    // Requires that we get the module control block.
-    pw.println("  else {");
-    pw.println("    var mcb = $wnd.__gwt_tryGetModuleControlBlock(location.search);");
-    pw.println("    if (mcb) {");
-    pw.println("      $moduleName = mcb.getName();");
-    pw.println("      mcb.compilationLoaded(window);");
-    pw.println("    }");
-    pw.println("  }");
-    pw.println("}");
-  }
-
-  /**
    * Records a mapping from a unique set of client property values onto a strong
    * name (that is, a compilation).
    * 
@@ -257,6 +191,104 @@
     }
   }
 
+  /**
+   * Generates a function that injects calls to a shared file-injection
+   * functions.
+   * 
+   * @param pw generate source onto this writer
+   */
+  private void genInjectExternalFiles(PrintWriter pw) {
+    pw.println();
+    pw.println("function injectExternalFiles() {");
+    pw.println("  var mcb = $wnd.__gwt_tryGetModuleControlBlock(location.search);");
+    pw.println("  if (!mcb) return;");
+    pw.println("  var base = mcb.getBaseURL();");
+
+    // Styles come first to give them a little more time to load.
+    pw.println("  mcb.addStyles([");
+    boolean needComma = false;
+    for (Iterator iter = styles.iterator(); iter.hasNext();) {
+      String src = (String) iter.next();
+      if (needComma) {
+        pw.println(",");
+      }
+      needComma = true;
+
+      pw.print("    ");
+      if (isRelativeURL(src)) {
+        pw.print("base+");
+      }
+      pw.print("'");
+      pw.print(src);
+      pw.print("'");
+    }
+    pw.println();
+    pw.println("    ]);");
+
+    // Scripts
+    pw.println("  mcb.addScripts([");
+    needComma = false;
+    for (Iterator iter = scripts.iterator(); iter.hasNext();) {
+      Script script = (Script) iter.next();
+      if (needComma) {
+        pw.println(",");
+      }
+      needComma = true;
+
+      // Emit the src followed by the module-ready function.
+      // Note that the module-ready function is a string because it gets
+      // eval'ed in the context of the host html window. This is absolutely
+      // required because otherwise in web mode (IE) you get an
+      // "cannot execute code from a freed script" error.
+      String src = script.getSrc();
+      pw.print("    ");
+      if (isRelativeURL(src)) {
+        pw.print("base+");
+      }
+      pw.print("'");
+      pw.print(src);
+      pw.print("', \"");
+      String readyFnJs = Jsni.generateEscapedJavaScript(script.getJsReadyFunction());
+      pw.print(readyFnJs);
+      pw.print("\"");
+    }
+    pw.println();
+    pw.println("    ]);");
+
+    pw.println("}");
+  }
+
+  private void genOnLoad(PrintWriter pw) {
+    // Emit the onload() function.
+    pw.println();
+    pw.println("function onLoad() {");
+
+    // Early out (or fall through below) if the page is loaded out of context.
+    pw.println("  if (!$wnd.__gwt_isHosted) return;");
+
+    // Maybe inject scripts.
+    if (hasExternalFiles()) {
+      pw.println("  injectExternalFiles();");
+    }
+
+    // If we're in web mode, run the compilation selector logic.
+    // The compilation will call mcb.compilationLoaded() itself.
+    pw.println("  if (!$wnd.__gwt_isHosted()) {");
+    pw.println("    selectScript();");
+    pw.println("  }");
+
+    // If we're in hosted mode, notify $wnd that we're ready to go.
+    // Requires that we get the module control block.
+    pw.println("  else {");
+    pw.println("    var mcb = $wnd.__gwt_tryGetModuleControlBlock(location.search);");
+    pw.println("    if (mcb) {");
+    pw.println("      $moduleName = mcb.getName();");
+    pw.println("      mcb.compilationLoaded(window);");
+    pw.println("    }");
+    pw.println("  }");
+    pw.println("}");
+  }
+
   private void genPropProviders(PrintWriter pw) {
     pw.println();
 
@@ -344,95 +376,51 @@
   }
 
   /**
-   * Generates a function that injects calls to a shared file-injection
-   * functions.
+   * Emits all the script required to set up the module and, in web mode, select
+   * a compilation.
    * 
-   * @param pw generate source onto this writer
+   * @param pw
+   * @return an expression that should be called as the body's onload handler
    */
-  private void genInjectExternalFiles(PrintWriter pw) {
-    pw.println();
-    pw.println("function injectExternalFiles() {");
-    pw.println("  var mcb = $wnd.__gwt_tryGetModuleControlBlock(location.search);");
-    pw.println("  if (!mcb) return;");
-    pw.println("  var base = mcb.getBaseURL();");  
+  private String genScript(PrintWriter pw) {
+    // Emit $wnd and $doc for dynamic property providers.
+    pw.println("var $wnd = parent;");
+    pw.println("var $doc = $wnd.document;");
+    pw.println("var $moduleName = null;");
 
-    // Styles come first to give them a little more time to load.
-    pw.println("  mcb.addStyles([");
-    boolean needComma = false;
-    for (Iterator iter = styles.iterator(); iter.hasNext();) {
-      String src = (String) iter.next();
-      if (needComma) {
-        pw.println(",");
+    // Emit property providers; these are used in both modes.
+    genPropProviders(pw);
+
+    // If the ordered props are specified, then we're generating for both modes.
+    if (orderedProps != null) {
+      // Web mode or hosted mode.
+      if (orderedProps.length > 0) {
+        pw.println();
+        genAnswerFunction(pw);
+        pw.println();
+        genSrcSetFunction(pw, null);
+      } else {
+        // Rare case of no properties; happens if you inherit from Core alone.
+        assert (orderedProps.length == 0);
+        Set entrySet = propertyValuesSetByStrongName.entrySet();
+        assert (entrySet.size() == 1);
+        Map.Entry entry = (Entry) entrySet.iterator().next();
+        String strongName = (String) entry.getKey();
+        genSrcSetFunction(pw, strongName);
       }
-      needComma = true;
-      
-      pw.print("    ");
-      if (isRelativeURL(src)) {
-        pw.print("base+"); 
-      }
-      pw.print("'");
-      pw.print(src);
-      pw.print("'");
+    } else {
+      // Hosted mode only, so there is no strong name selection (i.e. because
+      // there is no compiled JavaScript); do nothing
     }
-    pw.println();
-    pw.println("    ]);");
 
-    // Scripts
-    pw.println("  mcb.addScripts([");
-    needComma = false;
-    for (Iterator iter = scripts.iterator(); iter.hasNext();) {
-      Script script = (Script) iter.next();
-      if (needComma) {
-        pw.println(",");
-      }
-      needComma = true;
-
-      // Emit the src followed by the module-ready function.
-      // Note that the module-ready function is a string because it gets
-      // eval'ed in the context of the host html window. This is absolutely
-      // required because otherwise in web mode (IE) you get an
-      // "cannot execute code from a freed script" error.
-      String src = script.getSrc();
-      pw.print("    ");
-      if (isRelativeURL(src)) {
-        pw.print("base+");
-      }
-      pw.print("'");
-      pw.print(src);
-      pw.print("', \"");
-      String readyFnJs = Jsni.generateEscapedJavaScript(script.getJsReadyFunction());
-      pw.print(readyFnJs);
-      pw.print("\"");
+    // Emit dynamic file injection logic; same logic is used in both modes.
+    if (hasExternalFiles()) {
+      genInjectExternalFiles(pw);
     }
-    pw.println();
-    pw.println("    ]);");
 
-    pw.println("}");
-  }
+    genOnLoad(pw);
 
-  /**
-   * Determines whether or not the URL is relative. 
-   * @param src the test url
-   * @return <code>true</code> if the URL is relative, <code>false</code> if not
-   */
-  private boolean isRelativeURL(String src) {
-    // A straight absolute url for the same domain, server, and protocol.
-    if (src.startsWith("/")) {
-      return false;
-    } 
-
-    // If it can be parsed as a URL, then it's probably absolute.
-    try {
-      URL testUrl = new URL(src);
-      
-      // Let's guess that it is absolute (thus, not relative).
-      return false;
-    } catch (MalformedURLException e) {
-      // Do nothing, since it was a speculative parse.
-    }
-    
-    // Since none of the above matched, let's guess that it's relative.
-    return true;
+    return "onLoad()";
   }
 
   /**
@@ -471,19 +459,38 @@
     pw.println("}");
   }
 
-  private String literal(String lit) {
-    return "\"" + lit + "\"";
+  private boolean hasExternalFiles() {
+    return !scripts.isEmpty() || !styles.isEmpty();
   }
 
   /**
-   * Maps compilation strong name onto a <code>Set</code> of
-   * <code>String[]</code>. We use a <code>TreeMap</code> to produce the
-   * same generated code for the same set of compilations.
+   * Determines whether or not the URL is relative.
+   * 
+   * @param src the test url
+   * @return <code>true</code> if the URL is relative, <code>false</code> if
+   *         not
    */
-  private final Map propertyValuesSetByStrongName = new TreeMap();
-  private final Property[] orderedProps;
-  private final Properties moduleProps;
-  private final String moduleName;
-  private final Scripts scripts;
-  private final Styles styles;
+  private boolean isRelativeURL(String src) {
+    // A straight absolute url for the same domain, server, and protocol.
+    if (src.startsWith("/")) {
+      return false;
+    }
+
+    // If it can be parsed as a URL, then it's probably absolute.
+    try {
+      URL testUrl = new URL(src);
+
+      // Let's guess that it is absolute (thus, not relative).
+      return false;
+    } catch (MalformedURLException e) {
+      // Do nothing, since it was a speculative parse.
+    }
+
+    // Since none of the above matched, let's guess that it's relative.
+    return true;
+  }
+
+  private String literal(String lit) {
+    return "\"" + lit + "\"";
+  }
 }
diff --git a/dev/core/src/com/google/gwt/dev/util/TextOutput.java b/dev/core/src/com/google/gwt/dev/util/TextOutput.java
index ed71b76..fc7dd8e 100644
--- a/dev/core/src/com/google/gwt/dev/util/TextOutput.java
+++ b/dev/core/src/com/google/gwt/dev/util/TextOutput.java
@@ -26,13 +26,13 @@
 
   void print(char c);
 
+  void print(char[] s);
+
   void print(String s);
 
   void printOpt(char c);
 
-  void printOpt(String s);
-
   void printOpt(char[] s);
 
-  void print(char[] s);
+  void printOpt(String s);
 }
diff --git a/dev/core/src/com/google/gwt/dev/util/TextOutputOnCharArray.java b/dev/core/src/com/google/gwt/dev/util/TextOutputOnCharArray.java
index ce28c5c..3bc0317 100644
--- a/dev/core/src/com/google/gwt/dev/util/TextOutputOnCharArray.java
+++ b/dev/core/src/com/google/gwt/dev/util/TextOutputOnCharArray.java
@@ -21,126 +21,124 @@
 
 public class TextOutputOnCharArray implements TextOutput {
 
-    private final CharArrayWriter fCharArrayWriter;
-    private final boolean fCompact;
-    private int fIndent = 0;
-    private int fIndentGranularity;
-    private char[][] fIndents = new char[][] {
-        new char[0]
-    };
-    private boolean fJustNewlined;
-    private final PrintWriter p;
+  private final CharArrayWriter charArrayWriter;
+  private final boolean compact;
+  private int indent = 0;
+  private int indentGranularity;
+  private char[][] indents = new char[][] {new char[0]};
+  private boolean justNewlined;
+  private final PrintWriter p;
 
-    public TextOutputOnCharArray(boolean compact) {
-        fIndentGranularity = 2;
-        fCharArrayWriter = new CharArrayWriter(50 * 1024);
-        p = new PrintWriter(fCharArrayWriter);
-        fCompact = compact;
-    }
+  public TextOutputOnCharArray(boolean compact) {
+    indentGranularity = 2;
+    charArrayWriter = new CharArrayWriter(50 * 1024);
+    p = new PrintWriter(charArrayWriter);
+    this.compact = compact;
+  }
 
-    public int getIndent() {
-        return fIndent;
-    }
+  public int getIndent() {
+    return indent;
+  }
 
-    public char[] getText() {
-        return fCharArrayWriter.toCharArray();
-    }
+  public char[] getText() {
+    return charArrayWriter.toCharArray();
+  }
 
-    public void indentIn() {
-        ++fIndent;
-        if (fIndent >= fIndents.length) {
-            // Cache a new level of indentation string.
-            //
-            char[] newIndentLevel = new char[fIndent * fIndentGranularity];
-            Arrays.fill(newIndentLevel, ' ');
-            char[][] newIndents = new char[fIndents.length + 1][];
-            System.arraycopy(fIndents, 0, newIndents, 0, fIndents.length);
-            newIndents[fIndent] = newIndentLevel;
-            fIndents = newIndents;
-        }
+  public void indentIn() {
+    ++indent;
+    if (indent >= indents.length) {
+      // Cache a new level of indentation string.
+      //
+      char[] newIndentLevel = new char[indent * indentGranularity];
+      Arrays.fill(newIndentLevel, ' ');
+      char[][] newIndents = new char[indents.length + 1][];
+      System.arraycopy(indents, 0, newIndents, 0, indents.length);
+      newIndents[indent] = newIndentLevel;
+      indents = newIndents;
     }
+  }
 
-    public void indentOut() {
-        --fIndent;
-    }
+  public void indentOut() {
+    --indent;
+  }
 
-    private void maybeIndent() {
-        if (fJustNewlined && !fCompact) {
-            p.print(fIndents[fIndent]);
-            // TODO: remove flush calls
-            p.flush();
-            fJustNewlined = false;
-        }
-    }
+  public void newline() {
+    p.print('\n');
+    // TODO: remove flush calls
+    p.flush();
+    justNewlined = true;
+  }
 
-    public void newline() {
-        p.print('\n');
-        // TODO: remove flush calls
-        p.flush();
-        fJustNewlined = true;
+  public void newlineOpt() {
+    if (!compact) {
+      p.print('\n');
+      // TODO: remove flush calls
+      p.flush();
     }
+    justNewlined = true;
+  }
 
-    public void newlineOpt() {
-        if (!fCompact) {
-            p.print('\n');
-            // TODO: remove flush calls
-            p.flush();
-        }
-        fJustNewlined = true;
-    }
+  public void print(char c) {
+    maybeIndent();
+    p.print(c);
+    // TODO: remove flush calls
+    p.flush();
+    justNewlined = false;
+  }
 
-    public void print(char c) {
-        maybeIndent();
-        p.print(c);
-        // TODO: remove flush calls
-        p.flush();
-        fJustNewlined = false;
-    }
+  public void print(char[] s) {
+    maybeIndent();
+    p.print(s);
+    // TODO: remove flush calls
+    p.flush();
+    justNewlined = false;
+  }
 
-    public void print(char[] s) {
-        maybeIndent();
-        p.print(s);
-        // TODO: remove flush calls
-        p.flush();
-        fJustNewlined = false;
-    }
+  public void print(String s) {
+    maybeIndent();
+    p.print(s);
+    // TODO: remove flush calls
+    p.flush();
+    justNewlined = false;
+  }
 
-    public void print(String s) {
-        maybeIndent();
-        p.print(s);
-        // TODO: remove flush calls
-        p.flush();
-        fJustNewlined = false;
+  public void printOpt(char c) {
+    if (!compact) {
+      maybeIndent();
+      p.print(c);
+      // TODO: remove flush calls
+      p.flush();
     }
+  }
 
-    public void printOpt(char c) {
-        if (!fCompact) {
-            maybeIndent();
-            p.print(c);
-            // TODO: remove flush calls
-            p.flush();
-        }
+  public void printOpt(char[] s) {
+    if (!compact) {
+      maybeIndent();
+      p.print(s);
+      // TODO: remove flush calls
+      p.flush();
     }
+  }
 
-    public void printOpt(char[] s) {
-        if (!fCompact) {
-            maybeIndent();
-            p.print(s);
-            // TODO: remove flush calls
-            p.flush();
-        }
+  public void printOpt(String s) {
+    if (!compact) {
+      maybeIndent();
+      p.print(s);
+      // TODO: remove flush calls
+      p.flush();
     }
+  }
 
-    public void printOpt(String s) {
-        if (!fCompact) {
-            maybeIndent();
-            p.print(s);
-            // TODO: remove flush calls
-            p.flush();
-        }
-    }
+  public void setIndent(int indent) {
+    this.indent = indent;
+  }
 
-    public void setIndent(int indent) {
-        fIndent = indent;
+  private void maybeIndent() {
+    if (justNewlined && !compact) {
+      p.print(indents[indent]);
+      // TODO: remove flush calls
+      p.flush();
+      justNewlined = false;
     }
+  }
 }
diff --git a/dev/core/src/com/google/gwt/dev/util/TextOutputOnPrintWriter.java b/dev/core/src/com/google/gwt/dev/util/TextOutputOnPrintWriter.java
index 42e0462..c28d649 100644
--- a/dev/core/src/com/google/gwt/dev/util/TextOutputOnPrintWriter.java
+++ b/dev/core/src/com/google/gwt/dev/util/TextOutputOnPrintWriter.java
@@ -23,7 +23,7 @@
   private final boolean compact;
   private int identLevel = 0;
   private int indentGranularity;
-  private char[][] indents = new char[][]{new char[0]};
+  private char[][] indents = new char[][] {new char[0]};
   private boolean justNewlined;
   private final PrintWriter p;
 
@@ -56,13 +56,6 @@
     --identLevel;
   }
 
-  private void maybeIndent() {
-    if (justNewlined && !compact) {
-      p.print(indents[identLevel]);
-      justNewlined = false;
-    }
-  }
-
   public void newline() {
     p.println();
     justNewlined = true;
@@ -119,4 +112,11 @@
       p.flush();
     }
   }
+
+  private void maybeIndent() {
+    if (justNewlined && !compact) {
+      p.print(indents[identLevel]);
+      justNewlined = false;
+    }
+  }
 }
diff --git a/dev/core/src/com/google/gwt/dev/util/Util.java b/dev/core/src/com/google/gwt/dev/util/Util.java
index 9ba7f3d..24e2b99 100644
--- a/dev/core/src/com/google/gwt/dev/util/Util.java
+++ b/dev/core/src/com/google/gwt/dev/util/Util.java
@@ -75,7 +75,7 @@
 
   public static final String[] EMPTY_ARRAY_STRING = new String[0];
 
-  public static char[] HEX_CHARS = new char[]{
+  public static char[] HEX_CHARS = new char[] {
       '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D',
       'E', 'F'};
 
@@ -85,35 +85,6 @@
     }
   }
 
-  /**
-   * This method invokes an inaccessable method in another class.
-   * 
-   * @param targetClass the class owning the method
-   * @param methodName the name of the method
-   * @param argumentTypes the types of the parameters to the method call
-   * @param target the receiver of the method call
-   * @param arguments the parameters to the method call
-   */
-  public static void invokeInaccessableMethod(Class targetClass,
-      String methodName, Class[] argumentTypes, TypeOracle target,
-      Object[] arguments) {
-    String failedReflectErrMsg = "The definition of " + targetClass.getName()
-        + "." + methodName + " has changed in an " + "incompatible way.";
-    try {
-      Method m = targetClass.getDeclaredMethod(methodName, argumentTypes);
-      m.setAccessible(true);
-      m.invoke(target, arguments);
-    } catch (NoSuchMethodException e) {
-      throw new RuntimeException(failedReflectErrMsg, e);
-    } catch (IllegalArgumentException e) {
-      throw new RuntimeException(failedReflectErrMsg, e);
-    } catch (IllegalAccessException e) {
-      throw new RuntimeException(failedReflectErrMsg, e);
-    } catch (InvocationTargetException e) {
-      throw new RuntimeException(failedReflectErrMsg, e);
-    }
-  }
-
   public static byte[] append(byte[] xs, byte x) {
     int n = xs.length;
     byte[] t = new byte[n + 1];
@@ -375,6 +346,35 @@
     sb.append(HEX_CHARS[c & 0x000F]);
   }
 
+  /**
+   * This method invokes an inaccessable method in another class.
+   * 
+   * @param targetClass the class owning the method
+   * @param methodName the name of the method
+   * @param argumentTypes the types of the parameters to the method call
+   * @param target the receiver of the method call
+   * @param arguments the parameters to the method call
+   */
+  public static void invokeInaccessableMethod(Class targetClass,
+      String methodName, Class[] argumentTypes, TypeOracle target,
+      Object[] arguments) {
+    String failedReflectErrMsg = "The definition of " + targetClass.getName()
+        + "." + methodName + " has changed in an " + "incompatible way.";
+    try {
+      Method m = targetClass.getDeclaredMethod(methodName, argumentTypes);
+      m.setAccessible(true);
+      m.invoke(target, arguments);
+    } catch (NoSuchMethodException e) {
+      throw new RuntimeException(failedReflectErrMsg, e);
+    } catch (IllegalArgumentException e) {
+      throw new RuntimeException(failedReflectErrMsg, e);
+    } catch (IllegalAccessException e) {
+      throw new RuntimeException(failedReflectErrMsg, e);
+    } catch (InvocationTargetException e) {
+      throw new RuntimeException(failedReflectErrMsg, e);
+    }
+  }
+
   public static boolean isCompilationUnitOnDisk(String loc) {
     try {
       if (new File(loc).exists()) {
@@ -477,8 +477,8 @@
     // is a prefix of the 'to' path.
     //
     String toPath = tryMakeCanonical(to).getAbsolutePath();
-    File currentFrom = tryMakeCanonical(from.isDirectory() ? from : from
-        .getParentFile());
+    File currentFrom = tryMakeCanonical(from.isDirectory() ? from
+        : from.getParentFile());
 
     int numberOfBackups = 0;
     while (currentFrom != null) {
@@ -501,8 +501,7 @@
 
     // Find everything to the right of the common prefix.
     //
-    String trailingToPath = toPath.substring(currentFrom.getAbsolutePath()
-        .length());
+    String trailingToPath = toPath.substring(currentFrom.getAbsolutePath().length());
     if (currentFrom.getParentFile() != null && trailingToPath.length() > 0) {
       trailingToPath = trailingToPath.substring(1);
     }
@@ -887,7 +886,7 @@
 
   public static void writeBytesToFile(TreeLogger logger, File where, byte[] what)
       throws UnableToCompleteException {
-    writeBytesToFile(logger, where, new byte[][]{what});
+    writeBytesToFile(logger, where, new byte[][] {what});
   }
 
   /**