Saturday, October 5, 2019

Re: ClassCastException in some browser, but not others (


  --> IDBDatabase idb = Js.uncheckedCast(idbr.result);

would work too.

Yes, it does. 

The point is is uncheckedCast is (AFAIU) considered dangerous.

It's the only way I can get it to work though. 

There are two other casts that perform run-time checks but they have a 1) performance penalty and 2) some times throw exceptions not due to a bug but because the casting is invalid based on the type definitions GWT compiler knows about.

Here is the first type:
    a) Java cast         --> MyObject x = (MyObject) yourObject;
    b) Js checked cast   --> MyObject x = Js.cast(yourObject);
and of course
    c) Js unchecked cast --> MyObject x = Js.uncheckedCast(yourObject);

I think (not sure) that a) and b) are the same at least on development mode. Not so sure what they are doing in production mode.

Both a) and b) fail in production (on Safari and Chrome in ios) but work in Chrome desktop on OSX.

My 2 cents of limited understanding...



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
To view this discussion on the web visit

No comments:

Post a Comment