Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Comments

Fixes for google issues 11, 14, and 16#2

Open
rassilon wants to merge 10 commits intodstanek:masterfrom
rassilon:master
Open

Fixes for google issues 11, 14, and 16#2
rassilon wants to merge 10 commits intodstanek:masterfrom
rassilon:master

Conversation

@rassilon
Copy link

@rassilon rassilon commented Mar 2, 2013

Apologies for the messy commit history in the pull request.

I would have rebased but you're not supposed to do that for published history (i.e. google code).

You may notice I reverted the provider instance caching.
I don't think you can do that without verifying that the provider exists in the current binder's (or parent's) Singleton scope instance. (The fix for issue 11.)

The fix for issue 11 essentially means you need to register a scope to the binder by calling binder.bind_scope before you can bind something into the scope.

The binder.get_binding change if I recall correctly was to simplify life in the multibinder so that the multibinder class didn't have constructed Key instances. (Since the keys are so complex in multibinder.)

The reason for the complexity is that all items in the multibinding have individual bindings in the binder (as well as a dynamic provider to inject the multibinder).

The key of the dynamic provider class is:

Key(<_MultiBinderSubClass>.multibinding_type(<userSuppliedClass>),
       <userSuppliedAnnotation>)

The key of each of the multibinder items is:

Key(<userSuppliedClass>, 
       <unique _RealElement(
                       str(<userSuppliedAnnotation>), # the name 
                       <_MultiBinderSubClass>.multibinding_type.__name__) # the type
         instance>)

The core concept of these keys is _RealElement which is essentially:

 (<unique integer across all instances of _RealElement>, 
   <name>, <type>)

The new _ _ str _ _ method for Annotation is just as important since it becomes the name of _RealElement.

Thanks again for snake-guice,
Bill

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The specs command uses the sys module, but this import was missing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant