Hi

It seems here you are trying to cast a native js object to java type. 

Sometimes GWT generates ClassCastException when I cast type 
"@JsType(isNative=true) A" to type B which is also native type. This is 
also kind of magic for me and I also have a strange workaround: write a 
native method that does the cast by "return arg".  

I wrote about that earlier:

https://groups.google.com/forum/#!topic/google-web-toolkit/bBW-RU5wEGs

-Kirill


среда, 14 декабря 2016 г., 19:29:39 UTC+3 пользователь Norbert Bartels 
написал:
>
> Hi all,
>
> I’m migrating our GWT app to GWT 2.8 as a PoC because we like to use the 
> SDM.
>
> While testing the SDM I see some strange ClassCastExceptions in the 
> console.
>
> We use gxt 2 and changed some things to make it work with GWT > 2.5.1.
>
> Here’s the error message (stacktrace) of the the class cast exception:
>
> java.lang.ClassCastException
>     at Unknown.java_lang_Throwable_Throwable__V(Unknown Source)
>     at Unknown.java_lang_Exception_Exception__V(Unknown Source)
>     at Unknown.java_lang_RuntimeException_RuntimeException__V(Unknown Source)
>     at Unknown.java_lang_ClassCastException_ClassCastException__V(Unknown 
> Source)
>     at 
> Unknown.javaemul_internal_InternalPreconditions_checkCriticalType__ZV(Unknown 
> Source)
>     at Unknown.javaemul_internal_InternalPreconditions_checkType__ZV(Unknown 
> Source)
>     at 
> Unknown.com_google_gwt_lang_Cast_castTo__Ljava_lang_Object_2Lcom_google_gwt_core_client_JavaScriptObject_2Ljava_lang_Object_2(Unknown
>  Source)
>     at 
> Unknown.com_extjs_gxt_ui_client_widget_treegrid_TreeGridCellRenderer_getText__Lcom_extjs_gxt_ui_client_widget_treegrid_TreeGrid_2Lcom_extjs_gxt_ui_client_data_ModelData_2Ljava_lang_String_2IILjava_lang_String_2(Unknown
>  Source)
>     at 
> Unknown.com_extjs_gxt_ui_client_widget_treegrid_TreeGridCellRenderer_render__Lcom_extjs_gxt_ui_client_data_ModelData_2Ljava_lang_String_2Lcom_extjs_gxt_ui_client_widget_grid_ColumnData_2IILcom_extjs_gxt_ui_client_store_ListStore_2Lcom_extjs_gxt_ui_client_widget_grid_Grid_2Ljava_lang_Object_2(Unknown
>  Source)
>
> ...
>
> The code that triggers this exception is this (
> http://grepcode.com/file/repo1.maven.org/maven2/com.extjs/gxt/2.3.1-gwt22/com/extjs/gxt/ui/client/widget/treegrid/TreeGridCellRenderer.java/#59
> ):
>
> return String.valueOf(model.get(property));
>
> My temporary solution to fix this is:
>
> Object obj = model.get(property);
> String.valueOf(obj);
>
> I already found several places where the class cast exception occurs and 
> where this fix solves the problem, but I’m afraid that there’s something 
> going wrong somewhere in GWT.
>
> Cheers,
> Norbert
> ​
>

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