Tuesday, June 25, 2013

ClassCastException when using Code Splitting

I am working on a large application (greater than 500K lines of code) written using GWT.  I am working on new screen for the application, and have come across a problem with the code splitting as follows:

- The code works successfully when run in Development Mode.
- The code fails with a ClassCastException (stack trace below) when the code is compiled to javascript and run within the browser.
- If I create the class directly (not using GWT.runAsync()), the problem does not occur.
- I have attempted to create a simple testcase to demonstrate the problem, but when I do this the problem no longer occurs.
- The ClassCastException occurs within a custom widget that was developed for this application, and is used in hundreds of other places in the application without any similar problems.
- Due to the size of the application, code splitting is used extensively.

A stack trace of the error is as follows (compiled with -style DETAILED)

java.lang.ClassCastException:     at Unknown.java_lang_ClassCastException_ClassCastException__V(Unknown Source)    at Unknown.com_google_gwt_lang_Cast_dynamicCast__Ljava_lang_Object_2ILjava_lang_Object_2(Unknown Source)    at Unknown.au_edu_wa_eddept_irt_client_ui_DetScrollableGrid_$calculateDimensions__Lau_edu_wa_eddept_irt_client_ui_DetScrollableGrid_2V(Unknown Source)    at Unknown.au_edu_wa_eddept_irt_client_ui_DetScrollableGrid_$refreshData__Lau_edu_wa_eddept_irt_client_ui_DetScrollableGrid_2V(Unknown Source)    at Unknown.au_edu_wa_eddept_irt_client_ui_SortableDetScrollableGrid_$sort__Lau_edu_wa_eddept_irt_client_ui_SortableDetScrollableGrid_2V(Unknown Source)    at Unknown.au_edu_wa_eddept_irt_client_ui_SortableDetScrollableGrid_$setDisplayData__Lau_edu_wa_eddept_irt_client_ui_SortableDetScrollableGrid_2Ljava_util_List_2V(Unknown Source)    at Unknown.au_edu_wa_eddept_irt_client_panel_search_StudentSearchDialog$AsyncCallbackDoStudentSearch_$onSuccess__Lau_edu_wa_eddept_irt_client_panel_search_StudentSearchDialog$AsyncCallbackDoStudentSearch_2Lau_edu_wa_eddept_irt_client_rpc_Dispatch_2V(Unknown Source)    at Unknown.au_edu_wa_eddept_irt_client_panel_search_StudentSearchDialog$AsyncCallbackDoStudentSearch_onSuccess__Ljava_lang_Object_2V(Unknown Source)    at Unknown.au_edu_wa_eddept_irt_client_rpc_SecuredAsyncCallback_$onSuccess__Lau_edu_wa_eddept_irt_client_rpc_SecuredAsyncCallback_2Lau_edu_wa_eddept_irt_client_rpc_Dispatch_2V(Unknown Source)    at Unknown.au_edu_wa_eddept_irt_client_rpc_SecuredAsyncCallback_onSuccess__Ljava_lang_Object_2V(Unknown Source)    at Unknown.com_google_gwt_user_client_rpc_impl_RequestCallbackAdapter_$onResponseReceived__Lcom_google_gwt_user_client_rpc_impl_RequestCallbackAdapter_2Lcom_google_gwt_http_client_Request_2Lcom_google_gwt_http_client_Response_2V(Unknown Source)    at Unknown.com_google_gwt_http_client_Request_$fireOnResponseReceived__Lcom_google_gwt_http_client_Request_2Lcom_google_gwt_http_client_RequestCallback_2V(Unknown Source)    at Unknown.com_google_gwt_http_client_RequestBuilder$1_onReadyStateChange__Lcom_google_gwt_xhr_client_XMLHttpRequest_2V(Unknown Source)    at Unknown.this$static.onreadystatechange<(Unknown Source)    at Unknown.com_google_gwt_core_client_impl_Impl_apply__Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2(Unknown Source)    at Unknown.com_google_gwt_core_client_impl_Impl_entry0__Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2(Unknown Source)    at Unknown.anonymous(Unknown Source)    at Unknown.anonymous(Unknown Source)

Any suggestions on how I should proceed to find a resolution for this problem?

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment