Fixes issue #1176; better error created when using GWT.create() outside of client code.
Suggested by: bruce
Review by: mmendez
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@1249 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/core/client/GWT.java b/user/src/com/google/gwt/core/client/GWT.java
index ecc3739..ff295f7 100644
--- a/user/src/com/google/gwt/core/client/GWT.java
+++ b/user/src/com/google/gwt/core/client/GWT.java
@@ -61,8 +61,12 @@
* In web mode, the compiler directly replaces calls to this method with a
* new Object() type expression of the correct rebound type.
*/
- throw new RuntimeException(
- "GWT has not been properly initialized; if you are running a unit test, check that your test case extends GWTTestCase");
+ throw new UnsupportedOperationException(
+ "ERROR: GWT.create() is only usable in client code! It cannot be called, "
+ + "for example, from server code. If you are running a unit test, "
+ + "check that your test case extends GWTTestCase and that GWT.create() "
+ + "is not called from within an initializer, constructor, or "
+ + "setUp()/tearDown().");
}
/**