You should ask on https://groups.google.com/d/forum/google-gin as the GWT
Compiler is not involved in these decisions, only the GIN generator.
BTW, what's the error? Does it work if you don't use an AsyncProvider?
(direct injection, or through a Provider)
And as a workaround / alternative, I suppose you could use a "@Special
Provider<DiSecondary>" and an explicit GWT.runAsync.
On Sunday, August 26, 2012 7:28:39 PM UTC+2, Steve C wrote:
>
> If I want to inject an instance of a specific class based on an
> annotation, I can do this in a Gin module:
>
>
> bind(DiSecondary.class).annotatedWith(Special.class).to(DiSecondarySpecialImpl.class);
>
> I also already have:
>
> bind(DiSecondary.class).to(DiSecondaryImpl.class);
>
> I can then retrieve the special instance into my DiMain (Composite
> wrapping a Panel) constructor with:
>
> @Inject
> public DiMain(@Special DiSecondary special) {
> add(special);
> }
>
> But, if I want to code-split DiSecondarySpecialImpl using AsyncProvider,
> the analogous approach does not work:
>
> @Inject
> public DiMainAsync(@Special final AsyncProvider<DiSecondary>
> diSecondaryProvider) {
> diSecondaryProvider.get(new AsyncCallback<DiSecondary>() {
> public void onFailure(Throwable caught) {}
> public void onSuccess(DiSecondary result) {
> add(result);
> }
> });
> }
>
> I get a GWT compiler error. If I remove the annotation, then, of course,
> I get the non-special implementation.
>
> Am I being unreasonable to expect that the compiler could apply the
> annotation to the async provider for the base class instead of the base
> class itself?
>
> Is there a different route that I can use to get the desired behavior
> (annotation-based selection of an alternate async loaded class)?
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-web-toolkit/-/yk5j3nVbsiEJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.