Ensure getclass is called to throw TypeError. JsCompiler doesn't assume toString call may result in exceptions and consider them side effect free. This makes the test less fragile. PiperOrigin-RevId: 332939058 Change-Id: I34c6fed201b3d03820e7618b9e8bf79b63aae92a
diff --git a/user/test/com/google/gwt/emultest/java/lang/JsExceptionTest.java b/user/test/com/google/gwt/emultest/java/lang/JsExceptionTest.java index 511520d..0daaac2 100644 --- a/user/test/com/google/gwt/emultest/java/lang/JsExceptionTest.java +++ b/user/test/com/google/gwt/emultest/java/lang/JsExceptionTest.java
@@ -14,7 +14,6 @@ package com.google.gwt.emultest.java.lang; import com.google.gwt.testing.TestUtils; - import jsinterop.annotations.JsMethod; import jsinterop.annotations.JsPackage; import jsinterop.annotations.JsType; @@ -123,7 +122,7 @@ private static void throwTypeError() { Object nullObject = null; - nullObject.toString(); + nullObject.getClass(); } @JsType(isNative = true, namespace = "<window>")