Adds checking for 32-bit/64-bit instead of specific JRE versions. This change
makes it possible for Snow Leopard users to use hosted mode using the 32-bit
1.6 JRE.

Review by: jat

git-svn-id: https://google-web-toolkit.googlecode.com/svn/releases/1.7@6144 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src-dummy/com/google/gwt/dev/BootStrapPlatform.java b/dev/core/src-dummy/com/google/gwt/dev/BootStrapPlatform.java
index 3d2fc28..f38d4e1 100644
--- a/dev/core/src-dummy/com/google/gwt/dev/BootStrapPlatform.java
+++ b/dev/core/src-dummy/com/google/gwt/dev/BootStrapPlatform.java
@@ -29,7 +29,7 @@
     // nothing to do
   }
 
-  public static void initHostedMode() {
+  public static void initHostedMode(boolean is32Bit) {
     // nothing to do.
   }
 }
diff --git a/dev/core/src/com/google/gwt/dev/HostedModeBase.java b/dev/core/src/com/google/gwt/dev/HostedModeBase.java
index 07a5aef..a361016 100644
--- a/dev/core/src/com/google/gwt/dev/HostedModeBase.java
+++ b/dev/core/src/com/google/gwt/dev/HostedModeBase.java
@@ -343,6 +343,13 @@
     }
   }
 
+  /**
+   * Determine if we're using a 32 bit runtime.
+   */
+  private static boolean is32BitJvm() {
+    return "32".equals(System.getProperty("sun.arch.data.model"));
+  }
+
   protected final HostedModeBaseOptions options;
 
   /**
@@ -359,7 +366,7 @@
 
   public HostedModeBase() {
     // Set any platform specific system properties.
-    BootStrapPlatform.initHostedMode();
+    BootStrapPlatform.initHostedMode(is32BitJvm());
     BootStrapPlatform.applyPlatformHacks();
     options = createOptions();
   }
@@ -473,11 +480,10 @@
     // Initialize the logger.
     //
     initializeLogger();
-    
+
     // Check for updates
     final TreeLogger logger = getTopLogger();
-    final CheckForUpdates updateChecker
-        = PlatformSpecific.createUpdateChecker(logger);
+    final CheckForUpdates updateChecker = PlatformSpecific.createUpdateChecker(logger);
     if (updateChecker != null) {
       Thread checkerThread = new Thread("GWT Update Checker") {
         @Override
diff --git a/dev/linux/src/com/google/gwt/dev/BootStrapPlatform.java b/dev/linux/src/com/google/gwt/dev/BootStrapPlatform.java
index f3313c4..bf94eec 100644
--- a/dev/linux/src/com/google/gwt/dev/BootStrapPlatform.java
+++ b/dev/linux/src/com/google/gwt/dev/BootStrapPlatform.java
@@ -36,7 +36,12 @@
    * it. If successful, store the loaded path in the property swt.mozilla.path
    * so SWT's Browser object can use it.
    */
-  public static void initHostedMode() {
+  public static void initHostedMode(boolean is32Bit) {
+    if (!is32Bit) {
+      System.err.println("You must use a 32-bit runtime to run GWT Hosted Mode.");
+      System.exit(1);
+    }
+
     String home = System.getenv("HOME");
     if (home == null || home.length() == 0) {
       System.err.println("The HOME environment variable must be defined.");
diff --git a/dev/mac/src/com/google/gwt/dev/BootStrapPlatform.java b/dev/mac/src/com/google/gwt/dev/BootStrapPlatform.java
index 164a4a6..e9012f5 100644
--- a/dev/mac/src/com/google/gwt/dev/BootStrapPlatform.java
+++ b/dev/mac/src/com/google/gwt/dev/BootStrapPlatform.java
@@ -64,13 +64,15 @@
     Toolkit.getDefaultToolkit();
   }
 
-  public static void initHostedMode() {
+  public static void initHostedMode(boolean is32Bit) {
     /*
      * The following check must be made before attempting to initialize Safari,
      * or we'll fail with an less-than-helpful UnsatisfiedLinkError.
      */
-    if (!isJava5()) {
-      System.err.println("You must use a Java 1.5 runtime to use GWT Hosted Mode on Mac OS X.");
+    if (!is32Bit) {
+      System.err.println("You must use a 32-bit runtime to run GWT Hosted Mode.");
+      System.err.println("  Leopard: Use the Java 1.5 runtime.");
+      System.err.println("  Snow Leopard: Use the Java 1.6 runtime and add -d32");
       System.exit(-1);
     }
 
@@ -111,14 +113,6 @@
   }
 
   /**
-   * Determine if we're using the Java 1.5 runtime, since the 1.6 runtime is
-   * 64-bit.
-   */
-  private static boolean isJava5() {
-    return System.getProperty("java.version").startsWith("1.5");
-  }
-
-  /**
    * Sets platform specific system properties. Currently, this disables
    * CocoaComponent CompatibilityMode.
    * 
diff --git a/dev/windows/src/com/google/gwt/dev/BootStrapPlatform.java b/dev/windows/src/com/google/gwt/dev/BootStrapPlatform.java
index 7e261dc..8734d98 100644
--- a/dev/windows/src/com/google/gwt/dev/BootStrapPlatform.java
+++ b/dev/windows/src/com/google/gwt/dev/BootStrapPlatform.java
@@ -28,7 +28,10 @@
     // nothing to do
   }
 
-  public static void initHostedMode() {
-    // nothing to do
+  public static void initHostedMode(boolean is32Bit) {
+    if (!is32Bit) {
+      System.err.println("You must use a 32-bit runtime to run GWT Hosted Mode.");
+      System.exit(1);
+    }
   }
 }