Fwiw, here's a proof-of-concept annotation processor for 
gwteventbinder: 
https://gist.github.com/tbroyer/420004d02e905ba7ce9489d24d3bae72 
(uses auto-service, auto-common, and JavaPoet)
It'll generate an EventBinder_Xxx class implementing EventBinder<Xxx> for 
any class Xxx with methods annotated with @EventHandler, so you can replace 
things like:
  interface MyEventBinder extends EventBinder<Xxx> {}
  private static final MyEventBinder eventBinder = 
GWT.create(MyEventBinder.class);
with
  private static final EventBinder<Xxx> eventBinder = new EventBinder_Xxx();

With a small modification to EventBinder (adding an inherited annotation), 
one could write an annotation processor that's fully backwards-compatible 
with the current approach. The GWT generator could be changed to simply 
return the class generated by the annotation processor as a migration step 
before you replace the GWT.create() with an explicit "new", something like:
  interface MyEventBinder extends EventBinder<Xxx> {}
  private static final MyEventBinder eventBinder = new 
Xxx_MyEventBinderImpl();

Note that the annotation processor linked above does absolutely no error 
handling and assumes the annotation is used "correctly" (one big difference 
of annotation processors is that they're invoked even if the code wouldn't 
compile, e.g. applying the annotation to a type whereas it only targets 
methods, or if the value of the annotation properties don't have the 
correct type, such as @EventHandler(42); with a GWT generator, those errors 
would be caught earlier in the process so the generator is immune to them).

On Friday, June 2, 2017 at 8:47:38 PM UTC+2, Anders Forsell wrote:
>
> Yes, I'm just trying to move away from all GWT dependencies and hoping 
> that once J2CL is open-sourced I'll transition to it without having to wait 
> for GWT3.
>
> On Friday, June 2, 2017 at 7:10:24 PM UTC+2, Thomas Broyer wrote:
>>
>> GWT 3 will likely still have SimpleEventBus (and it would compile with 
>> j2cl without change).
>>
>> And gwteventbinder could quite easily be ported to an annotation 
>> processor.
>>
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit-contributors/3450016d-0834-4a7c-a8bc-b3aa4ae1fd2b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to