ekuefler / gwt-supereventbus

High-octane event bus for GWT
https://ekuefler.github.io/gwt-supereventbus
Apache License 2.0
39 stars 2 forks source link

Fix EventBus.register method. In production mode only class literals can be created by GWT.create. #4

Closed arnor2000 closed 11 years ago

arnor2000 commented 11 years ago

GWT compiler was complaining about the call of GWT.create with a class variable in EventBus.register method. It's easy to forget but javadoc is clear: GWT.create(java.lang.Class<?> classLiteral)

The argument to create(Class) must be a class literal because the Production Mode compiler must be able to statically determine the requested type at compile-time. This can be tricky because using a Class variable may appear to work correctly in Development Mode.

I see no other solution than having to externalize the GWT.create, developer has to instantiate himself the EventRegistration interface and pass it to the EventBus.register, as usual.

I changed all unit tests, they are all passing.

ekuefler commented 11 years ago

Too bad, I didn't realize this didn't word in prod mode. Thanks a lot for the fix!