On Friday, February 3, 2017 at 4:55:06 PM UTC+1, Alex opn wrote:
>
> What is the risk of disabling these checks?
>

If your code depends on ClassCastException, IndexOutOfBoundsException, etc. 
to be thrown, then it'll no longer work as intended. The checks make sure 
the contracts of the emulated Java API is respected; disabling the checks 
means the contracts are no longer guaranteed.

For example:

try {
  o = myList.get(2);
} catch (IndexOutOfBoundsException ioobe) {
  // handle error; e.g. show error to the user, or log it to the console or 
up to the server
}

This code would break with checks disabled. 'o' would simply be 'null' 
instead of the exception being thrown.

The "correct" way to program this is:

if (myList.size() > 2) {
  o = myList.get(2);
} else {
  // handle error
}

And similarly use "o instanceof MyObj" instead of "try { (MyObj) o; } catch 
(ClassClassException cce) { … }".

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to