Removes StringHelper.
Change-Id: Iecc07c29529541f4b6420bc4c6d3424263e6c30d
diff --git a/dev/core/super/javaemul/internal/StringHelper.java b/dev/core/super/javaemul/internal/StringHelper.java
deleted file mode 100644
index 8c81612..0000000
--- a/dev/core/super/javaemul/internal/StringHelper.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2015 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 javaemul.internal;
-
-/**
- * StringHelper contains utility methods for String processing that are used by multiple classes
- * in GWT's emul.
- */
-public class StringHelper {
- public static String valueOf(char x[], int start, int end) {
- // Work around function.prototype.apply call stack size limits:
- // https://code.google.com/p/v8/issues/detail?id=2896
- // Performance: http://jsperf.com/string-fromcharcode-test/13
- int batchSize = ArrayHelper.ARRAY_PROCESS_BATCH_SIZE;
- String s = "";
- for (int batchStart = start; batchStart < end;) {
- int batchEnd = Math.min(batchStart + batchSize, end);
- s += fromCharCode(ArrayHelper.unsafeClone(x, batchStart, batchEnd));
- batchStart = batchEnd;
- }
- return s;
- }
-
- private static native String fromCharCode(Object array) /*-{
- return String.fromCharCode.apply(null, array);
- }-*/;
-}
-
diff --git a/user/super/com/google/gwt/emul/java/lang/Long.java b/user/super/com/google/gwt/emul/java/lang/Long.java
index 77a3fd3..ec8c799 100644
--- a/user/super/com/google/gwt/emul/java/lang/Long.java
+++ b/user/super/com/google/gwt/emul/java/lang/Long.java
@@ -15,8 +15,6 @@
*/
package java.lang;
-import javaemul.internal.StringHelper;
-
/**
* Wraps a primitive <code>long</code> as an object.
*/
@@ -193,7 +191,7 @@
buf[pos--] = Character.forDigit(-((int) value));
buf[pos] = '-';
}
- return StringHelper.valueOf(buf, pos, bufSize);
+ return String.valueOf(buf, pos, bufSize - pos);
}
public static Long valueOf(long i) {
@@ -231,7 +229,7 @@
value >>>= shift;
} while (value != 0);
- return StringHelper.valueOf(buf, pos, bufSize);
+ return String.valueOf(buf, pos, bufSize - pos);
}
private final transient long value;
diff --git a/user/super/com/google/gwt/emul/java/lang/String.java b/user/super/com/google/gwt/emul/java/lang/String.java
index fa35254..cbbe5b9 100644
--- a/user/super/com/google/gwt/emul/java/lang/String.java
+++ b/user/super/com/google/gwt/emul/java/lang/String.java
@@ -25,9 +25,9 @@
import java.util.Comparator;
import java.util.Locale;
+import javaemul.internal.ArrayHelper;
import javaemul.internal.EmulatedCharset;
import javaemul.internal.HashCodes;
-import javaemul.internal.StringHelper;
import javaemul.internal.annotations.DoNotInline;
/**
@@ -114,11 +114,25 @@
public static String valueOf(char x[], int offset, int count) {
int end = offset + count;
checkStringBounds(offset, end, x.length);
- return StringHelper.valueOf(x, offset, end);
+ // Work around function.prototype.apply call stack size limits:
+ // https://code.google.com/p/v8/issues/detail?id=2896
+ // Performance: http://jsperf.com/string-fromcharcode-test/13
+ int batchSize = ArrayHelper.ARRAY_PROCESS_BATCH_SIZE;
+ String s = "";
+ for (int batchStart = offset; batchStart < end;) {
+ int batchEnd = Math.min(batchStart + batchSize, end);
+ s += fromCharCode(ArrayHelper.unsafeClone(x, batchStart, batchEnd));
+ batchStart = batchEnd;
+ }
+ return s;
}
+ private static native String fromCharCode(Object array) /*-{
+ return String.fromCharCode.apply(null, array);
+ }-*/;
+
public static String valueOf(char[] x) {
- return StringHelper.valueOf(x, 0, x.length);
+ return valueOf(x, 0, x.length);
}
public static String valueOf(double x) {