Remove critical checks in StringJoiner.
It was hacked in 4ece80 but now compiler handles
null CharSequence correctly.
Fixes StringJoinerTest to accept JSE instead of NPE
in web mode.
Change-Id: I417de8ab5531f18119e4f39cbe5573e7e01d9720
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 0e67640..68ddb2d 100644
--- a/user/super/com/google/gwt/emul/java/util/StringJoiner.java
+++ b/user/super/com/google/gwt/emul/java/util/StringJoiner.java
@@ -15,8 +15,6 @@
*/
package java.util;
-import static javaemul.internal.InternalPreconditions.checkCriticalNotNull;
-
/**
* See <a href="https://docs.oracle.com/javase/8/docs/api/java/util/StringJoiner.html">
* the official Java API doc</a> for details.
@@ -35,13 +33,6 @@
}
public StringJoiner(CharSequence delimiter, CharSequence prefix, CharSequence suffix) {
-
- // TODO(dankurka): remove these checks once we have the proper compiler fix
- // for Charsequence.toString() with null values.
- checkCriticalNotNull(delimiter, "delimiter");
- checkCriticalNotNull(prefix, "prefix");
- checkCriticalNotNull(suffix, "suffix");
-
this.delimiter = delimiter.toString();
this.prefix = prefix.toString();
this.suffix = suffix.toString();
@@ -73,9 +64,6 @@
}
public StringJoiner setEmptyValue(CharSequence emptyValue) {
- // TODO: null.toString() does not throw exception
- checkCriticalNotNull(emptyValue);
-
this.emptyValue = emptyValue.toString();
return this;
}
diff --git a/user/test/com/google/gwt/emultest/java8/util/StringJoinerTest.java b/user/test/com/google/gwt/emultest/java8/util/StringJoinerTest.java
index 33950cc..6601535 100644
--- a/user/test/com/google/gwt/emultest/java8/util/StringJoinerTest.java
+++ b/user/test/com/google/gwt/emultest/java8/util/StringJoinerTest.java
@@ -44,6 +44,8 @@
fail("NullPointerException must be thrown if any constructor parameter is null");
} catch (NullPointerException e) {
// expected
+ } catch (JavaScriptException e) {
+ // expected
}
}
@@ -90,6 +92,8 @@
fail("NullPointerException must be thrown if emptyValue is null");
} catch (NullPointerException e) {
// expected
+ } catch (JavaScriptException e) {
+ // expected
}
}
}
\ No newline at end of file