T t = constructionContext.getCurrentReference();
if (t != null) {
return t;
}
} finally {
constructionContext.removeCurrentReference();
}
membersInjector.notifyListeners(t, errors);
--
You received this message because you are subscribed to the Google Groups "google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-guice...@googlegroups.com.
To post to this group, send email to google...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-guice?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
I agree that this seems wrong with AssistedInject, but I'm not clear on what you'd otherwise expect. If it didn't cache, then you'd fail with a StackOverflowException (since you'd recurse forever).
sam
Hummm.... It doesn't seem to work! Maybe I'm missing something?
While writing, I considered notifying a ProvisionListener to still be "part of the construction". I remember wondering about this specific part (whether the finally should be inside or outside), and ended up settling on "outside". But, I can't really give you any concrete reason of why I settled on that.There's a few different places we notify provision listeners (and I added one more internally, to notify on toInstance/bindConstant bindings too... still waiting on the sync-stuff to be fixed to push that out), so I'd have to analyze all of them to really figure it out.
Thanks for following up on this. A simplified test case would he much appreciated.
sam
--
You received this message because you are subscribed to the Google Groups "google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-guice...@googlegroups.com.
To post to this group, send email to google...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-guice.
Interesting. I haven't fully digested it, but if its causing surprising behavior that you're having trouble explaining, then I think a test case would be useful. If only so we can examine it more closely and figure out if there is indeed a bug.
I'm on vacation atm without access to a pc, but afaict you're matching on Binding.getKey which is the "from" part of the binding. Without assistedinject there will be a just-in-time untargetted binding that matches; ie the implementation type, equivalent to bind(MyImpl.class);
With assistedinject the implementation is hidden inside the factory binding, which is why the matcher no longer matches unless you add the init'able interface to the binding interface.
IIRC it is possible get the implementation type from the assistedinject SPI binding type and from there look for the init'able interface. Should just be a matter of extending your matcher to be aware of other more specific binding types.
Will take a closer look when I get back.
--
If it's necessary to check for those types, then you could just have the matcher return 'true' always for provider bindings, and your onProvision method will be the same (because it already does the instanceof check).