It's because asserts are removed when compiled to javascript. Use asserts for things that are so wrong that it's a programming error that ought to be caught in development mode, and you don't want to pay any overhead in production for it.
Nathan Wells wrote: > I've noticed that a lot of GWT code uses asserts rather than > RuntimeExceptions (like IllegalArgumentException and > IllegalStateException). I would go ahead an follow that template, but > I want to be sure I understand why it's done. To that end: > > 1) Are any other GWT developers using asserts rather than > RuntimeExceptions? > 2) If you answered "I do", why do you do it? > 3) If there are any GWTers listening (perhaps I should cross-post to > gwt-contrib?), is this a best practice recommended by GWT, or is it > more of a stylistic thing? > > -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
