Saturday, October 5, 2019

Re: ClassCastException in some browser, but not others (

Hi,
Probably

  --> 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...

Thanks. 

    Vassilis


--
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 google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/CAEQ-_W3y13M-PX2_A76wV68GSkYCnaZ8c1bON1NzvgGM7PwPgw%40mail.gmail.com.

No comments:

Post a Comment