GWT调用DOM.getElementById时应该没有导致NullPointerException

我们的应用程序有一部分可以做到这一点……

int x = DOM.getElementById("x").getPropertyInt("value"); int y = DOM.getElementById("y").getPropertyInt("value"); int w = DOM.getElementById("w").getPropertyInt("value"); int h = DOM.getElementById("h").getPropertyInt("value"); 

DOM.getElemendById("something")每次调用都返回null (我希望在删除它们时),但在返回值null时调用.getPropertyInt("value")不会导致NullPointerException。 在开发模式下,我能够逐步完成所有这些语句,并观察x,y,w,h都被赋值为零。 如果我在调试器中的Intellij求值程序中评估其中一个语句,则会抛出NullPointerException。

这对其他人来说似乎有点疯狂吗?

文档说 :

 Exceptions: try, catch, finally and user-defined exceptions are supported as normal, although Throwable.getStackTrace() is not meaningfully supported in production mode. Note: Several fundamental exceptions implicitly produced by the Java VM, most notably NullPointerException, StackOverflowError, and OutOfMemoryError, do not occur in production mode as such. Instead, a JavaScriptException is produced for any implicitly generated exceptions. This is because the nature of the underlying JavaScript exception cannot be reliably mapped onto the appropriate Java exception type. 

哇看起来像GWT覆盖类型创建的任何东西都可以做到这一点……

http://code.google.com/p/google-web-toolkit/issues/detail?id=5030