I tried to use GWT-Exporter and it worked just fine when I copied the example. Then I tried to export an mvp4g Presenter Here's what I did:
@Export()
@Presenter(view = RegisterPluginDisplay.class)
public class RegisterPluginPresenterImpl extends BasePresenter<RegisterPluginView, MyBus implements RootPresenter { ... }
public interface RegisterPluginPresenter extends Exportable { ... }
//then in the start event I said:
ExporterUtil.exportAll();
It gave me this error:
Uncaught java.lang.AssertionErrorcom_mvp4g_client_Mvp4gModuleImpl_com_mvp4g_client_Mvp4gModuleGinjector_com_mvp4g_client_Mvp4gModule…:62 get_Key$type$com$joseph$draw4$client$presenter$RegisterPluginPresenterImpl$_annotation$$none$$_0_g$com_mvp4g_client_Mvp4gModuleImpl_com_mvp4g_client_Mvp4gModuleGinjectorImpl.java:34 getcom_joseph_draw4_client_presenter_RegisterPluginPresenterImpl_0_g$Mvp4gModuleImpl.java:101 createAndStartModule_0_g$Mvp4gEntryPoint.java:35 onModuleLoad_5_g$com_00046joseph_00046draw4_00046Draw4JUnit__EntryMethodHolder.java:3 init_2_g$ModuleUtils.java:44 initializeModules_0_g$Impl.java:247 apply_0_g$Impl.java:306 entry0_0_g$Impl.java:72 (anonymous function)ModuleUtils.java:55 gwtOnLoad_0_g$Map.java:29 (anonymous function)
I looked at the code and found that GWT.create() was unsucessful in creating the presenter. I tried to create an exported class and then using GWT.create on it and found that I can't use GWT.create with any class that implements Exportable even if I don't do ExporterUtils.exportAll(). The documentation for the Exportable interface says that the GWT.create() statement returns an Exportable. That explains the class cast exception. So how do I fix this?
mvp4g uses GIN to create instances of presenters. GIN uses
GWT.create(YourPresenter.class)to create an instance of the class.As long as you don't have any deferred binding rule related to YourPresenter class GWT.create will behave like a new in Java.
In cases you are marking anything with the Exporter interface, the GWT Exporter Generator will be triggered. The generator create the exporter implementation which can not be used with mvp4g.