Add missing null check String.toString
Change-Id: I1c95cf6978c172b3eebf828f22e4076b8b479e4a
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 cfe2586..6421e68 100644
--- a/user/super/com/google/gwt/emul/java/lang/String.java
+++ b/user/super/com/google/gwt/emul/java/lang/String.java
@@ -17,6 +17,7 @@
package java.lang;
import static javaemul.internal.InternalPreconditions.checkCriticalStringBounds;
+import static javaemul.internal.InternalPreconditions.checkNotNull;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
@@ -750,7 +751,7 @@
* Magic: this method is only used during compiler optimizations; the generated JS will instead alias
* this method to the native String.prototype.toString() function.
*/
- return this;
+ return checkNotNull(this);
}
public String trim() {
diff --git a/user/super/com/google/gwt/emul/java/util/StringJoiner.java b/user/super/com/google/gwt/emul/java/util/StringJoiner.java
index 6071c03..c93b3b4 100644
--- a/user/super/com/google/gwt/emul/java/util/StringJoiner.java
+++ b/user/super/com/google/gwt/emul/java/util/StringJoiner.java
@@ -35,11 +35,6 @@
}
public StringJoiner(CharSequence delimiter, CharSequence prefix, CharSequence suffix) {
- // TODO: null.toString() does not throw exception
- checkCriticalNotNull(delimiter, "delimiter");
- checkCriticalNotNull(prefix, "prefix");
- checkCriticalNotNull(suffix, "suffix");
-
this.delimiter = delimiter.toString();
this.prefix = prefix.toString();
this.suffix = suffix.toString();
@@ -96,4 +91,4 @@
builder.append(delimiter);
}
}
-}
\ No newline at end of file
+}