Revision: 7183
Author: [email protected]
Date: Wed Nov 25 08:41:43 2009
Log: Fix external issue 4260: FieldSerializer problems with non-Latin class  
names

Review by: jat


http://code.google.com/p/google-web-toolkit/source/detail?r=7183

Modified:
  /trunk/dev/core/src/com/google/gwt/dev/util/Name.java

=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/util/Name.java       Fri Jul 31  
13:43:46 2009
+++ /trunk/dev/core/src/com/google/gwt/dev/util/Name.java       Wed Nov 25  
08:41:43 2009
@@ -15,6 +15,8 @@
   */
  package com.google.gwt.dev.util;

+import java.util.regex.Pattern;
+
  /**
   * Utility methods for dealing with the various types of Java names.
   */
@@ -87,7 +89,7 @@
      public static String toSourceName(String binaryName) {
        assert isBinaryName(binaryName);
        // don't change a trailing $ to a .
-      return binaryName.replaceAll("[$](\\w)", ".$1");
+      return NON_TRAILING_DOLLAR.matcher(binaryName).replaceAll(".$1");
      }

      private BinaryName() {
@@ -167,7 +169,7 @@
        public static String toSourceName(String internalName) {
          assert isInternalName(internalName);
          // don't change a trailing $ or slash to a .
-        return internalName.replaceAll("[$/](\\w)", ".$1");
+        return  
NON_TRAILING_DOLLAR_SLASH.matcher(internalName).replaceAll(".$1");
        }

        private InternalName() {
@@ -219,9 +221,17 @@

      public static String toSourceName(String dottedName) {
        // don't change a trailing $ to a .
-      return dottedName.replaceAll("[$](\\w)", ".$1");
+      return NON_TRAILING_DOLLAR.matcher(dottedName).replaceAll(".$1");
      }
    }
+
+  // Non-trailing $
+  private static final Pattern NON_TRAILING_DOLLAR =
+    Pattern.compile("[$](\\p{javaJavaIdentifierStart})");
+
+  // Non-trailing $ or /
+  private static final Pattern NON_TRAILING_DOLLAR_SLASH =
+    Pattern.compile("[$/](\\p{javaJavaIdentifierStart})");

    /**
     * Get the binary name for a Java class.

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

Reply via email to