BTW,
My proposed implementation is to rewrite these methods changing the
literal parameter to the result of invoking GWT.create() at the call
site, e.g.
interface MyService extends RemoteService<MyServiceAsync> { ... }
// example call
OAuth.withSignature(MyService.class).method1(arg1, arg2, asyncCallback);
public class OAuth {
@GwtCreate // method must be static, class parameter must be final
public static <S, T extends RemoteService<S>> S withSignature(final
Class<T> service) {
// GWT.create with non-literal ONLY allowed
// if enclosing method is @GwtCreate and
// variable statically resolvable to literal param
S async = GWT.create(service);
((ServiceDefTarget)async).setRequestBuilderCallback(new
OAuthRequestBuilderSigner());
return async;
}
}
after rewrite at callsite:
Object async = GWT.create(MyService.class);
OAuth.withSignature(async).method1(arg1, arg2, asyncCallback);
rewritten method:
public class OAuth {
@GwtCreate // method must be static, class parameter must be final
public static <S, T extends RemoteService<S>> S withSignature(Object
asyncInstance) {
//S async = GWT.create(service); replaced with instance
S async = (S)asyncInstance;
((ServiceDefTarget)async).setRequestBuilderCallback(new
OAuthRequestBuilderSigner());
return async;
}
}
This doesn't handle generator override or extra params, but it's a
start and could work with minimal changes to ReplaceRebinds.
-Ray
On Thu, Mar 12, 2009 at 7:17 PM, Ray Cromwell <[email protected]> wrote:
> Yeah, it's mostly the same as was discussed in the past. I just
> decided to resurrect the idea given that 1.6 is almost shipped to
> ensure it has a good chance of making it into the next version.
>
> -Ray
>
> On Thu, Mar 12, 2009 at 5:49 PM, Ian Petersen <[email protected]> wrote:
>>
>> Seems like this might be related to
>> http://code.google.com/p/google-web-toolkit/issues/detail?id=2243
>>
>> I like the idea.
>>
>> Ian
>>
>> >>
>>
>
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---