Reviewers: jat,

Description:
Add String.equals(String) to the String emulation code.  Compiled output
of Showcase shows that the method is nicely optimized to a == b rather
than requiring an instanceof check and a function call.  Of course it
would be nicer for the compiler to figure this out but this is a quick
fix for now.

Please review this at http://gwt-code-reviews.appspot.com/126820

Affected files:
   user/super/com/google/gwt/emul/java/lang/String.java


Index: user/super/com/google/gwt/emul/java/lang/String.java
===================================================================
--- user/super/com/google/gwt/emul/java/lang/String.java        (revision 7346)
+++ user/super/com/google/gwt/emul/java/lang/String.java        (working copy)
@@ -23,6 +23,7 @@
  package java.lang;

  import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.user.client.Window;

  import java.io.Serializable;
  import java.util.Comparator;
@@ -468,6 +469,10 @@
      return __equals(this, other);
    }

+  public boolean equals(String other) {
+    return __equals(this, other);
+  }
+
    public native boolean equalsIgnoreCase(String other) /*-{
      if (other == null)
        return false;


-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to