On Mon, Jun 22, 2009 at 2:08 PM, Lex Spoon<sp...@google.com> wrote:
> The options I see are:
> 1. Annotate the surrounding method with something like @RunAsyncName("Foo")
> 2. Use the fully-qualified method name surrounding the call.
> 3. Use the fully-qualified type name of the callback object.
> 4. Use a new parameter to runAsync indicating the name.

One possible refinement to option 1, since it seems likely to "win":
put the annotation on the onSuccess rather than on the method that
contains the runAsync invocation.

Here's what I mean:

   // ... surrounding code ...
   GWT.runAsync(new AsyncCallback() {

     public void onFailure(Throwable caught) {
       // deal with failure
     }

     @SplitPointName("I like Bruce's idea")
     public void onSuccess() {
       // deal with success
     }
   });
   // ... surrounding code ...

I'm not sure if it's better or worse, but it seems more flexible than
requiring a surrounding method.

To be a little bit forgiving to the developer, you could make it a
compile-time warning if onFailure is annotated and an error if both
onFailure and onSuccess are annotated with different names--it makes
the generator code more complex but lets the user be a little bit
forgetful.  Not sure if that's really necessary, though.

Ian

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to