Comment #7 on issue 342 by sberlin: Disable Just-in-time bindings
http://code.google.com/p/google-guice/issues/detail?id=342
Re: Bob's comment, "Could we just add a disableJitBindings() method to
Binder?" --
IMO, this is a kind of configuration thing more akin to setting the Stage.
If it
were possible to enable/disable JIT on a per-module basis, then it'd go
well into a
Module (but JIT fundamentally is outside the scope of a single Module is
applies to
the whole Injector, post creation). It'd be strange to install a separate
module
that has a side effect of disabling JIT, or to add disableJIT into a
Modules.overridden module. There's a separate issue (issue 395) for
integrating an
InjectorBuilder, so this solves that one nicely too.
Re: some other things.. I realized last night that there's a small
oversight in the
current patch. Injector.getBinding calls getBindingOrThrow with 'allowJit'
true
because many extensions & utility code use it to introspect bindings
(including the
bindings that LinkedBindings link to, which are usually all JIT bindings).
In the
current patch, allowJit lets you create JIT bindings as well as retrieve
existing
ones. The allowJit parameter either should become an enum { NO_JIT,
EXISTING_JIT,
NEW_OR_EXISTING_JIT } or another parameter should be added (to accomplish
the same
purpose). getBinding should use EXISTING_JIT, whereas BoundProviderFactory
&
FactoryProxy should use NEW_OR_EXISTING_JIT. getBindingOrThrow would pass
that off
to getJustInTimeBinding, and it'd fail on top of the enum was NO_JIT and a
new check
after the synchronized block if it wasn't NEW_OR_EXISTING_JIT.
Without the change, getBinding can be used to bypass disabling of JIT
bindings.
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"google-guice-dev" group.
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-guice-dev?hl=en
-~----------~----~----~----~------~----~------~--~---