code: private static CharSequence reverse(CharSequence s) {
      int length = s.length();
      if (length <= 1) {
        return s;
      }
  
      char[] buffer = new char[length];
      buffer[0] = s.charAt(length - 1);
  
      for (int i = 1; i < length; i++) {
        buffer[i] = s.charAt(length - 1 - i);
        if (Character.isSurrogatePair(buffer[i], buffer[i - 1])) {
          swap(buffer, i - 1, i);
        }
      }
  
      return new String(buffer);
    }
docs: Reverses a character sequence. This is borrowed from
  https://code.google.com/p/google-web-toolkit/source/detail?r=11591#
  and can be replaced with a simple {@code StringBuffer#reverse} once GWT 2.6 is available.