Remove PlatformSpecific, moving the functionality into SwtHostedModeBase or
CheckForUpdates.  This means there is one less class that has to be shadowed
in OOPHM.

Patch by: jat
Review by: scottb


git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@5030 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/Compiler.java b/dev/core/src/com/google/gwt/dev/Compiler.java
index be43d78..8f8a348 100644
--- a/dev/core/src/com/google/gwt/dev/Compiler.java
+++ b/dev/core/src/com/google/gwt/dev/Compiler.java
@@ -25,7 +25,6 @@
 import com.google.gwt.dev.cfg.ModuleDefLoader;
 import com.google.gwt.dev.jjs.JJSOptions;
 import com.google.gwt.dev.shell.CheckForUpdates;
-import com.google.gwt.dev.shell.PlatformSpecific;
 import com.google.gwt.dev.shell.CheckForUpdates.UpdateResult;
 import com.google.gwt.dev.util.FileBackedObject;
 import com.google.gwt.dev.util.PerfLogger;
@@ -132,12 +131,12 @@
         public boolean run(TreeLogger logger) throws UnableToCompleteException {
           FutureTask<UpdateResult> updater = null;
           if (!options.isUpdateCheckDisabled()) {
-            updater = PlatformSpecific.checkForUpdatesInBackgroundThread(
-                logger, CheckForUpdates.ONE_DAY);
+            updater = CheckForUpdates.checkForUpdatesInBackgroundThread(logger,
+                CheckForUpdates.ONE_DAY);
           }
           boolean success = new Compiler(options).run(logger);
           if (success) {
-            PlatformSpecific.logUpdateAvailable(logger, updater);
+            CheckForUpdates.logUpdateAvailable(logger, updater);
           }
           return success;
         }
diff --git a/dev/core/src/com/google/gwt/dev/GWTCompiler.java b/dev/core/src/com/google/gwt/dev/GWTCompiler.java
index 08d7f85..4224a2f 100644
--- a/dev/core/src/com/google/gwt/dev/GWTCompiler.java
+++ b/dev/core/src/com/google/gwt/dev/GWTCompiler.java
@@ -24,7 +24,6 @@
 import com.google.gwt.dev.cfg.ModuleDefLoader;
 import com.google.gwt.dev.jjs.JJSOptions;
 import com.google.gwt.dev.shell.CheckForUpdates;
-import com.google.gwt.dev.shell.PlatformSpecific;
 import com.google.gwt.dev.shell.CheckForUpdates.UpdateResult;
 import com.google.gwt.dev.util.FileBackedObject;
 import com.google.gwt.dev.util.PerfLogger;
@@ -119,12 +118,12 @@
         public boolean run(TreeLogger logger) throws UnableToCompleteException {
           FutureTask<UpdateResult> updater = null;
           if (!options.isUpdateCheckDisabled()) {
-            updater = PlatformSpecific.checkForUpdatesInBackgroundThread(
+            updater = CheckForUpdates.checkForUpdatesInBackgroundThread(
                 logger, CheckForUpdates.ONE_DAY);
           }
           boolean success = new GWTCompiler(options).run(logger);
           if (success) {
-            PlatformSpecific.logUpdateAvailable(logger, updater);
+            CheckForUpdates.logUpdateAvailable(logger, updater);
           }
           return success;
         }
diff --git a/dev/core/src/com/google/gwt/dev/HostedModeBase.java b/dev/core/src/com/google/gwt/dev/HostedModeBase.java
index f99d8dd..ecdf0d9 100644
--- a/dev/core/src/com/google/gwt/dev/HostedModeBase.java
+++ b/dev/core/src/com/google/gwt/dev/HostedModeBase.java
@@ -29,7 +29,6 @@
 import com.google.gwt.dev.shell.BrowserWindowController;
 import com.google.gwt.dev.shell.CheckForUpdates;
 import com.google.gwt.dev.shell.ModuleSpaceHost;
-import com.google.gwt.dev.shell.PlatformSpecific;
 import com.google.gwt.dev.shell.ShellModuleSpaceHost;
 import com.google.gwt.dev.util.Util;
 import com.google.gwt.dev.util.arg.ArgHandlerDisableAggressiveOptimization;
@@ -193,6 +192,7 @@
       HostedModeBase.this.compile(getLogger());
     }
 
+    @Deprecated
     public void compile(String[] moduleNames) throws UnableToCompleteException {
       if (!isLegacyMode()) {
         throw new UnsupportedOperationException();
@@ -431,6 +431,8 @@
 
   /**
    * Compiles all modules.
+   * 
+   * @throws UnableToCompleteException
    */
   protected abstract void compile(TreeLogger logger)
       throws UnableToCompleteException;
@@ -481,12 +483,12 @@
     // Check for updates
     final TreeLogger logger = getTopLogger();
     final CheckForUpdates updateChecker
-        = PlatformSpecific.createUpdateChecker(logger);
+        = CheckForUpdates.createUpdateChecker(logger);
     if (updateChecker != null) {
       Thread checkerThread = new Thread("GWT Update Checker") {
         @Override
         public void run() {
-          PlatformSpecific.logUpdateAvailable(logger,
+          CheckForUpdates.logUpdateAvailable(logger,
               updateChecker.check(checkForUpdatesInterval()));
         }
       };
diff --git a/dev/core/src/com/google/gwt/dev/Precompile.java b/dev/core/src/com/google/gwt/dev/Precompile.java
index fb64d94..4609a65 100644
--- a/dev/core/src/com/google/gwt/dev/Precompile.java
+++ b/dev/core/src/com/google/gwt/dev/Precompile.java
@@ -38,7 +38,6 @@
 import com.google.gwt.dev.jjs.UnifiedAst;
 import com.google.gwt.dev.jjs.impl.FragmentLoaderCreator;
 import com.google.gwt.dev.shell.CheckForUpdates;
-import com.google.gwt.dev.shell.PlatformSpecific;
 import com.google.gwt.dev.shell.StandardRebindOracle;
 import com.google.gwt.dev.shell.CheckForUpdates.UpdateResult;
 import com.google.gwt.dev.util.PerfLogger;
@@ -299,12 +298,12 @@
         public boolean run(TreeLogger logger) throws UnableToCompleteException {
           FutureTask<UpdateResult> updater = null;
           if (!options.isUpdateCheckDisabled()) {
-            updater = PlatformSpecific.checkForUpdatesInBackgroundThread(
-                logger, CheckForUpdates.ONE_DAY);
+            updater = CheckForUpdates.checkForUpdatesInBackgroundThread(logger,
+                CheckForUpdates.ONE_DAY);
           }
           boolean success = new Precompile(options).run(logger);
           if (success) {
-            PlatformSpecific.logUpdateAvailable(logger, updater);
+            CheckForUpdates.logUpdateAvailable(logger, updater);
           }
           return success;
         }
diff --git a/dev/core/src/com/google/gwt/dev/SwtHostedModeBase.java b/dev/core/src/com/google/gwt/dev/SwtHostedModeBase.java
index a737d3b..8a73bb5 100644
--- a/dev/core/src/com/google/gwt/dev/SwtHostedModeBase.java
+++ b/dev/core/src/com/google/gwt/dev/SwtHostedModeBase.java
@@ -22,7 +22,6 @@
 import com.google.gwt.dev.shell.BrowserWidget;
 import com.google.gwt.dev.shell.BrowserWidgetHost;
 import com.google.gwt.dev.shell.ModuleSpaceHost;
-import com.google.gwt.dev.shell.PlatformSpecific;
 import com.google.gwt.dev.shell.ShellMainWindow;
 import com.google.gwt.dev.shell.ShellModuleSpaceHost;
 import com.google.gwt.dev.util.log.AbstractTreeLogger;
@@ -35,9 +34,12 @@
 import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.swt.internal.Library;
 import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Shell;
 
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -74,6 +76,16 @@
     }
   }
 
+  /**
+   * All of these classes must extend BrowserWidget. The first one that loads
+   * will be used, so it is important that only the correct one be on the
+   * classpath.
+   */
+  private static final String[] browserClassNames = new String[] {
+      "com.google.gwt.dev.shell.ie.BrowserWidgetIE6",
+      "com.google.gwt.dev.shell.moz.BrowserWidgetMoz",
+      "com.google.gwt.dev.shell.mac.BrowserWidgetSaf"};
+
   static {
     // Force ToolBase to clinit, which causes SWT stuff to happen.
     new ToolBase() {
@@ -82,6 +94,47 @@
     Display.setAppName("GWT");
   }
 
+  private static BrowserWidget createBrowserWidget(TreeLogger logger,
+      Composite parent, BrowserWidgetHost host)
+      throws UnableToCompleteException {
+    Throwable caught = null;
+    try {
+      for (int i = 0; i < browserClassNames.length; i++) {
+        Class<? extends BrowserWidget> clazz = null;
+        try {
+          clazz = Class.forName(browserClassNames[i]).asSubclass(
+              BrowserWidget.class);
+          Constructor<? extends BrowserWidget> ctor = clazz.getDeclaredConstructor(new Class[] {
+              Shell.class, BrowserWidgetHost.class});
+          BrowserWidget bw = ctor.newInstance(new Object[] {parent, host});
+          return bw;
+        } catch (ClassNotFoundException e) {
+          caught = e;
+        }
+      }
+      logger.log(TreeLogger.ERROR,
+          "No instantiable browser widget class could be found", caught);
+      throw new UnableToCompleteException();
+    } catch (SecurityException e) {
+      caught = e;
+    } catch (NoSuchMethodException e) {
+      caught = e;
+    } catch (IllegalArgumentException e) {
+      caught = e;
+    } catch (InstantiationException e) {
+      caught = e;
+    } catch (IllegalAccessException e) {
+      caught = e;
+    } catch (InvocationTargetException e) {
+      caught = e.getTargetException();
+    } catch (ClassCastException e) {
+      caught = e;
+    }
+    logger.log(TreeLogger.ERROR,
+        "The browser widget class could not be instantiated", caught);
+    throw new UnableToCompleteException();
+  }
+
   private BrowserWidgetHostImpl browserHost = new SwtBrowserWidgetHostImpl();
 
   private final List<Shell> browserShells = new ArrayList<Shell>();
@@ -147,8 +200,7 @@
     boolean succeeded = false;
     Shell s = createTrackedBrowserShell();
     try {
-      BrowserWidget bw = PlatformSpecific.createBrowserWidget(getTopLogger(),
-          s, browserHost);
+      BrowserWidget bw = createBrowserWidget(getTopLogger(), s, browserHost);
 
       if (mainWnd != null) {
         Rectangle r = mainWnd.getShell().getBounds();
diff --git a/dev/core/src/com/google/gwt/dev/shell/CheckForUpdates.java b/dev/core/src/com/google/gwt/dev/shell/CheckForUpdates.java
index 51bfbe4..e02230d 100644
--- a/dev/core/src/com/google/gwt/dev/shell/CheckForUpdates.java
+++ b/dev/core/src/com/google/gwt/dev/shell/CheckForUpdates.java
@@ -16,6 +16,7 @@
 package com.google.gwt.dev.shell;
 
 import com.google.gwt.core.ext.TreeLogger;
+import com.google.gwt.core.ext.TreeLogger.HelpInfo;
 import com.google.gwt.dev.About;
 
 import org.w3c.dom.Document;
@@ -33,10 +34,16 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.PrintWriter;
+import java.lang.reflect.Constructor;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLConnection;
 import java.util.Date;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.FutureTask;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
 import java.util.prefs.Preferences;
 
 import javax.xml.parsers.DocumentBuilder;
@@ -182,6 +189,110 @@
   // The real URL that should be used.
   private static final String QUERY_URL = "http://tools.google.com/webtoolkit/currentversion.xml";
 
+  /**
+   * All of these classes must extend CheckForUpdates. Note that currently only
+   * IE has a custom implementation (to handle proxies) and that CheckForUpdates
+   * must be the last one in the list.
+   */
+  private static final String[] updaterClassNames = new String[] {
+      "com.google.gwt.dev.shell.ie.CheckForUpdatesIE6",
+      "com.google.gwt.dev.shell.CheckForUpdates"};
+
+  public static FutureTask<UpdateResult> checkForUpdatesInBackgroundThread(
+      final TreeLogger logger, final long minCheckMillis) {
+    final String entryPoint = computeEntryPoint();
+    FutureTask<UpdateResult> task = new FutureTask<UpdateResult>(
+        new Callable<UpdateResult>() {
+          public UpdateResult call() throws Exception {
+            final CheckForUpdates updateChecker = createUpdateChecker(logger,
+                entryPoint);
+            return updateChecker == null ? null
+                : updateChecker.check(minCheckMillis);
+          }
+        });
+    Thread checkerThread = new Thread(task, "GWT Update Checker");
+    checkerThread.setDaemon(true);
+    checkerThread.start();
+    return task;
+  }
+
+  /**
+   * Find the first method named "main" on the call stack and use its class as
+   * the entry point.
+   */
+  public static String computeEntryPoint() {
+    Throwable t = new Throwable();
+    for (StackTraceElement stackTrace : t.getStackTrace()) {
+      if (stackTrace.getMethodName().equals("main")) {
+        // Strip package name from main's class
+        String className = stackTrace.getClassName();
+        int i = className.lastIndexOf('.');
+        if (i >= 0) {
+          return className.substring(i + 1);
+        }
+        return className;
+      }
+    }
+    return null;
+  }
+
+  public static CheckForUpdates createUpdateChecker(TreeLogger logger) {
+    return createUpdateChecker(logger, computeEntryPoint());
+  }
+
+  public static CheckForUpdates createUpdateChecker(TreeLogger logger,
+      String entryPoint) {
+    try {
+      for (int i = 0; i < updaterClassNames.length; i++) {
+        try {
+          Class<? extends CheckForUpdates> clazz = Class.forName(
+              updaterClassNames[i]).asSubclass(CheckForUpdates.class);
+          Constructor<? extends CheckForUpdates> ctor = clazz.getDeclaredConstructor(new Class[] {
+              TreeLogger.class, String.class});
+          CheckForUpdates checker = ctor.newInstance(new Object[] {
+              logger, entryPoint});
+          return checker;
+        } catch (Exception e) {
+          // Other exceptions can occur besides ClassNotFoundException,
+          // so ignore them all so we can find a functional updater.
+        }
+      }
+    } catch (Throwable e) {
+      // silently ignore any errors
+    }
+    return null;
+  }
+
+  public static void logUpdateAvailable(TreeLogger logger,
+      FutureTask<UpdateResult> updater) {
+    if (updater != null && updater.isDone()) {
+      UpdateResult result = null;
+      try {
+        result = updater.get(0, TimeUnit.MILLISECONDS);
+      } catch (InterruptedException e) {
+        // Silently ignore exception
+      } catch (ExecutionException e) {
+        // Silently ignore exception
+      } catch (TimeoutException e) {
+        // Silently ignore exception
+      }
+      logUpdateAvailable(logger, result);
+    }
+  }
+
+  public static void logUpdateAvailable(TreeLogger logger, UpdateResult result) {
+    if (result != null) {
+      final URL url = result.getURL();
+      logger.log(TreeLogger.WARN, "A new version of GWT ("
+          + result.getNewVersion() + ") is available", null, new HelpInfo() {
+        @Override
+        public URL getURL() {
+          return url;
+        }
+      });
+    }
+  }
+
   private static String getTextOfLastElementHavingTag(Document doc,
       String tagName) {
     NodeList nodeList = doc.getElementsByTagName(tagName);
@@ -201,7 +312,9 @@
   }
 
   private String entryPoint;
+
   private TreeLogger logger;
+
   private GwtVersion myVersion;
 
   /**
diff --git a/dev/core/src/com/google/gwt/dev/shell/PlatformSpecific.java b/dev/core/src/com/google/gwt/dev/shell/PlatformSpecific.java
deleted file mode 100644
index dfeaa8b..0000000
--- a/dev/core/src/com/google/gwt/dev/shell/PlatformSpecific.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright 2006 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.shell;
-
-import com.google.gwt.core.ext.TreeLogger;
-import com.google.gwt.core.ext.UnableToCompleteException;
-import com.google.gwt.core.ext.TreeLogger.HelpInfo;
-import com.google.gwt.dev.shell.CheckForUpdates.UpdateResult;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.net.URL;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.FutureTask;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-/**
- * Performs platform-specific class selection.
- */
-public class PlatformSpecific {
-
-  /**
-   * All of these classes must extend BrowserWidget.
-   */
-  private static final String[] browserClassNames = new String[] {
-      "com.google.gwt.dev.shell.ie.BrowserWidgetIE6",
-      "com.google.gwt.dev.shell.moz.BrowserWidgetMoz",
-      "com.google.gwt.dev.shell.mac.BrowserWidgetSaf"};
-
-  /**
-   * All of these classes must extend CheckForUpdates. Note that currently only
-   * IE has a custom implementation (to handle proxies) and that CheckForUpdates
-   * must be the last one in the list.
-   */
-  private static final String[] updaterClassNames = new String[] {
-      "com.google.gwt.dev.shell.ie.CheckForUpdatesIE6",
-      "com.google.gwt.dev.shell.CheckForUpdates"};
-
-  public static FutureTask<UpdateResult> checkForUpdatesInBackgroundThread(
-      final TreeLogger logger, final long minCheckMillis) {
-    final String entryPoint = PlatformSpecific.computeEntryPoint();
-    FutureTask<UpdateResult> task = new FutureTask<UpdateResult>(
-        new Callable<UpdateResult>() {
-          public UpdateResult call() throws Exception {
-            final CheckForUpdates updateChecker = createUpdateChecker(logger,
-                entryPoint);
-            return updateChecker == null ? null
-                : updateChecker.check(minCheckMillis);
-          }
-        });
-    Thread checkerThread = new Thread(task, "GWT Update Checker");
-    checkerThread.setDaemon(true);
-    checkerThread.start();
-    return task;
-  }
-
-  /**
-   * Find the first method named "main" on the call stack and use its class as
-   * the entry point.
-   */
-  public static String computeEntryPoint() {
-    Throwable t = new Throwable();
-    for (StackTraceElement stackTrace : t.getStackTrace()) {
-      if (stackTrace.getMethodName().equals("main")) {
-        // Strip package name from main's class
-        String className = stackTrace.getClassName();
-        int i = className.lastIndexOf('.');
-        if (i >= 0) {
-          return className.substring(i + 1);
-        }
-        return className;
-      }
-    }
-    return null;
-  }
-
-  public static BrowserWidget createBrowserWidget(TreeLogger logger,
-      Composite parent, BrowserWidgetHost host)
-      throws UnableToCompleteException {
-    Throwable caught = null;
-    try {
-      for (int i = 0; i < browserClassNames.length; i++) {
-        Class<? extends BrowserWidget> clazz = null;
-        try {
-          clazz = Class.forName(browserClassNames[i]).asSubclass(
-              BrowserWidget.class);
-          Constructor<? extends BrowserWidget> ctor = clazz.getDeclaredConstructor(new Class[] {
-              Shell.class, BrowserWidgetHost.class});
-          BrowserWidget bw = ctor.newInstance(new Object[] {parent, host});
-          return bw;
-        } catch (ClassNotFoundException e) {
-          caught = e;
-        }
-      }
-      logger.log(TreeLogger.ERROR,
-          "No instantiable browser widget class could be found", caught);
-      throw new UnableToCompleteException();
-    } catch (SecurityException e) {
-      caught = e;
-    } catch (NoSuchMethodException e) {
-      caught = e;
-    } catch (IllegalArgumentException e) {
-      caught = e;
-    } catch (InstantiationException e) {
-      caught = e;
-    } catch (IllegalAccessException e) {
-      caught = e;
-    } catch (InvocationTargetException e) {
-      caught = e.getTargetException();
-    } catch (ClassCastException e) {
-      caught = e;
-    }
-    logger.log(TreeLogger.ERROR,
-        "The browser widget class could not be instantiated", caught);
-    throw new UnableToCompleteException();
-  }
-
-  public static CheckForUpdates createUpdateChecker(TreeLogger logger) {
-    return createUpdateChecker(logger, computeEntryPoint());
-  }
-
-  public static CheckForUpdates createUpdateChecker(TreeLogger logger,
-      String entryPoint) {
-    try {
-      for (int i = 0; i < updaterClassNames.length; i++) {
-        try {
-          Class<? extends CheckForUpdates> clazz = Class.forName(
-              updaterClassNames[i]).asSubclass(CheckForUpdates.class);
-          Constructor<? extends CheckForUpdates> ctor = clazz.getDeclaredConstructor(new Class[] {
-              TreeLogger.class, String.class});
-          CheckForUpdates checker = ctor.newInstance(new Object[] {
-              logger, entryPoint});
-          return checker;
-        } catch (Exception e) {
-          // Other exceptions can occur besides ClassNotFoundException,
-          // so ignore them all so we can find a functional updater.
-        }
-      }
-    } catch (Throwable e) {
-      // silently ignore any errors
-    }
-    return null;
-  }
-
-  public static void logUpdateAvailable(TreeLogger logger,
-      FutureTask<UpdateResult> updater) {
-    if (updater != null && updater.isDone()) {
-      UpdateResult result = null;
-      try {
-        result = updater.get(0, TimeUnit.MILLISECONDS);
-      } catch (InterruptedException e) {
-        // Silently ignore exception
-      } catch (ExecutionException e) {
-        // Silently ignore exception
-      } catch (TimeoutException e) {
-        // Silently ignore exception
-      }
-      logUpdateAvailable(logger, result);
-    }
-  }
-
-  public static void logUpdateAvailable(TreeLogger logger, UpdateResult result) {
-    if (result != null) {
-      final URL url = result.getURL();
-      logger.log(TreeLogger.INFO, "A new version of GWT ("
-          + result.getNewVersion() + ") is available", null, new HelpInfo() {
-        @Override
-        public URL getURL() {
-          return url;
-        }
-      });
-    }
-  }
-}
diff --git a/dev/oophm/overlay/com/google/gwt/dev/shell/PlatformSpecific.java b/dev/oophm/overlay/com/google/gwt/dev/shell/PlatformSpecific.java
deleted file mode 100644
index 09bf046..0000000
--- a/dev/oophm/overlay/com/google/gwt/dev/shell/PlatformSpecific.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright 2006 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.shell;
-
-import com.google.gwt.core.ext.TreeLogger;
-import com.google.gwt.core.ext.TreeLogger.HelpInfo;
-import com.google.gwt.dev.shell.CheckForUpdates.UpdateResult;
-
-import java.lang.reflect.Constructor;
-import java.net.URL;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.FutureTask;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-/**
- * Performs platform-specific class selection.
- */
-public class PlatformSpecific {
-
-  /**
-   * All of these classes must extend CheckForUpdates. Note that currently only
-   * IE has a custom implementation (to handle proxies) and that CheckForUpdates
-   * must be the last one in the list.
-   */
-  private static final String[] updaterClassNames = new String[] {
-      "com.google.gwt.dev.shell.ie.CheckForUpdatesIE6",
-      "com.google.gwt.dev.shell.CheckForUpdates"};
-
-  public static FutureTask<UpdateResult> checkForUpdatesInBackgroundThread(
-      final TreeLogger logger, final long minCheckMillis) {
-    final String entryPoint = PlatformSpecific.computeEntryPoint();
-    FutureTask<UpdateResult> task = new FutureTask<UpdateResult>(
-        new Callable<UpdateResult>() {
-          public UpdateResult call() throws Exception {
-            final CheckForUpdates updateChecker = createUpdateChecker(logger,
-                entryPoint);
-            return updateChecker == null ? null
-                : updateChecker.check(minCheckMillis);
-          }
-        });
-    Thread checkerThread = new Thread(task, "GWT Update Checker");
-    checkerThread.setDaemon(true);
-    checkerThread.start();
-    return task;
-  }
-
-  /**
-   * Find the first method named "main" on the call stack and use its class as
-   * the entry point.
-   */
-  public static String computeEntryPoint() {
-    Throwable t = new Throwable();
-    for (StackTraceElement stackTrace : t.getStackTrace()) {
-      if (stackTrace.getMethodName().equals("main")) {
-        // Strip package name from main's class
-        String className = stackTrace.getClassName();
-        int i = className.lastIndexOf('.');
-        if (i >= 0) {
-          return className.substring(i + 1);
-        }
-        return className;
-      }
-    }
-    return null;
-  }
-
-  public static CheckForUpdates createUpdateChecker(TreeLogger logger) {
-    return createUpdateChecker(logger, computeEntryPoint());
-  }
-
-  public static CheckForUpdates createUpdateChecker(TreeLogger logger,
-      String entryPoint) {
-    try {
-      for (int i = 0; i < updaterClassNames.length; i++) {
-        try {
-          Class<? extends CheckForUpdates> clazz = Class.forName(
-              updaterClassNames[i]).asSubclass(CheckForUpdates.class);
-          Constructor<? extends CheckForUpdates> ctor = clazz.getDeclaredConstructor(new Class[] {
-              TreeLogger.class, String.class});
-          CheckForUpdates checker = ctor.newInstance(new Object[] {
-              logger, entryPoint});
-          return checker;
-        } catch (Exception e) {
-          // Other exceptions can occur besides ClassNotFoundException,
-          // so ignore them all so we can find a functional updater.
-        }
-      }
-    } catch (Throwable e) {
-      // silently ignore any errors
-    }
-    return null;
-  }
-
-  public static void logUpdateAvailable(TreeLogger logger,
-      FutureTask<UpdateResult> updater) {
-    if (updater != null && updater.isDone()) {
-      UpdateResult result = null;
-      try {
-        result = updater.get(0, TimeUnit.MILLISECONDS);
-      } catch (InterruptedException e) {
-        // Silently ignore exception
-      } catch (ExecutionException e) {
-        // Silently ignore exception
-      } catch (TimeoutException e) {
-        // Silently ignore exception
-      }
-      logUpdateAvailable(logger, result);
-    }
-  }
-
-  public static void logUpdateAvailable(TreeLogger logger, UpdateResult result) {
-    if (result != null) {
-      final URL url = result.getURL();
-      logger.log(TreeLogger.WARN, "A new version of GWT ("
-          + result.getNewVersion() + ") is available", null, new HelpInfo() {
-        @Override
-        public URL getURL() {
-          return url;
-        }
-      });
-    }
-  }
-}