Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(66)

Issue 3297042: Second iteration on GIN extensions (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 4 months ago by philippe.beaudoin
Modified:
13 years, 2 months ago
Reviewers:
Aragos, t.broyer
Base URL:
http://google-gin.googlecode.com/svn/trunk/
Visibility:
Public.

Description

This patch includes everything from: http://codereview.appspot.com/3269042/ Modifications include a mechanism for associating a GinModuleExtension with the GinModule-s that use it. This ensures a GinModuleExtension is only install()-ed with its module, and it removes the need for an isInstance filter in GinModuleExtension.filter (still a good practice to do them for error checking.)

Patch Set 1 #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+403 lines, -71 lines) Patch
src/com/google/gwt/inject/client/AsyncProviderModule.java View 1 chunk +11 lines, -0 lines 0 comments Download
src/com/google/gwt/inject/client/GinExtensions.java View 1 chunk +32 lines, -0 lines 0 comments Download
src/com/google/gwt/inject/client/Ginjector.java View 1 chunk +1 line, -0 lines 0 comments Download
src/com/google/gwt/inject/client/assistedinject/FactoryModule.java View 2 chunks +3 lines, -0 lines 0 comments Download
src/com/google/gwt/inject/rebind/BindingsProcessor.java View 15 chunks +166 lines, -53 lines 3 comments Download
src/com/google/gwt/inject/rebind/adapter/BinderAdapter.java View 3 chunks +7 lines, -12 lines 0 comments Download
src/com/google/gwt/inject/rebind/adapter/GinModuleAdapter.java View 3 chunks +5 lines, -6 lines 0 comments Download
src/com/google/gwt/inject/rebind/ext/FactoryModuleExtension.java View 1 chunk +66 lines, -0 lines 2 comments Download
src/com/google/gwt/inject/rebind/ext/GinInstanceExtension.java View 1 chunk +27 lines, -0 lines 0 comments Download
src/com/google/gwt/inject/rebind/ext/GinModuleExtension.java View 1 chunk +24 lines, -0 lines 0 comments Download
src/com/google/gwt/inject/rebind/ext/GinModuleExtensionContext.java View 1 chunk +34 lines, -0 lines 0 comments Download
src/com/google/gwt/inject/rebind/ext/GinProviderExtension.java View 1 chunk +27 lines, -0 lines 0 comments Download

Messages

Total messages: 4
philippe.beaudoin
13 years, 4 months ago (2010-11-25 05:11:53 UTC) #1
philippe.beaudoin
http://codereview.appspot.com/3297042/diff/1/src/com/google/gwt/inject/rebind/ext/FactoryModuleExtension.java File src/com/google/gwt/inject/rebind/ext/FactoryModuleExtension.java (right): http://codereview.appspot.com/3297042/diff/1/src/com/google/gwt/inject/rebind/ext/FactoryModuleExtension.java#newcode37 src/com/google/gwt/inject/rebind/ext/FactoryModuleExtension.java:37: if (module instanceof FactoryModule<?>) { We probably want to ...
13 years, 4 months ago (2010-11-25 05:18:24 UTC) #2
t.broyer
I think the overall workflow could be: 1. collect modules (in createModules and BinderAdapter#install) 2. ...
13 years, 4 months ago (2010-11-25 14:37:49 UTC) #3
t.broyer
13 years, 4 months ago (2010-11-26 13:29:00 UTC) #4
http://codereview.appspot.com/3297042/diff/1/src/com/google/gwt/inject/rebind...
File src/com/google/gwt/inject/rebind/BindingsProcessor.java (right):

http://codereview.appspot.com/3297042/diff/1/src/com/google/gwt/inject/rebind...
src/com/google/gwt/inject/rebind/BindingsProcessor.java:186: private final
Map<GinModule, Set<Class<? extends GinModuleExtension>>>
On 2010/11/25 14:37:49, t.broyer wrote:
> It means every GinModule has to not break the hashCode/equals contract
(unlikely
> to happen, but still).

Actually, it seems to be a feature of Guice that modules that compare equals are
installed once only (see Elements.RecordingBinder –the only implementation of
the Binder interface– which uses a Set<Module> and explicitly tests
modules.add() in the install() method, which BTW is also used when creating an
Injector:
http://code.google.com/p/google-guice/source/browse/trunk/core/src/com/google...
)

So not only it is safe to use a Map, but it's the "expected behavior" (even
though I'm unable to find where it's documented).

This feature is used by Multibinder so that multiple modules can contribute to a
single Set with a given Key<?>, without duplicate bindings from the
RealMultibinder#configure().
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b