-
Notifications
You must be signed in to change notification settings - Fork 28
Description
Currently in order to add more bindings you can either combine modules (~/andThen) or mergeWithReplace (also withBindingModules but has the limitation that applies only to empty modules)
Problem with 1: it returns a combined module so you'll end up having to manually combine in the main module all your submodules
Problem with 1 and 2: mergeWithReplace allows you to distribute module installation as in Guice and mix it into modules that already contain bindings which is nice
Eample
Mod A:
bind a to ...
bind b to ...
withMergeReplace(Mod B)
ModB
bind c to ...
etc...
The only problem is that both andThen and mergeWithReplace apply overriding policies and so you could end up wiping a binding without knowing it because the project is broad, Guice throws an exception at runtime complaining about accidental (not forced override) double bindings.
Would it be possible to add something similar to Guice binder.install? Which basically is exactly withMergeReplace without replacing and signaling an accidental double binding.
Thanks