On Tuesday, 9 September 2014 04:55:31 UTC-4, Thomas Broyer wrote: > > On Tuesday, September 9, 2014 3:09:21 AM UTC+2, Hanlu Chen wrote: >> >> There are four modules A, B, C, D. >> Their dependency is like graph below >> A D >> | \ / >> | B >> | / >> C >> Could I install C & B in A and then install C in B again? >> The experiment would just work, but I failed to find any doc supporting >> this. >> > > IIRC, the modules need to compare equal (i.e. C.equals(C) == true), > otherwise C would be installed twice and lead to duplicate bindings. > Not sure there's any doc, but I remember fixing something similar in GIN > (Guice for/in GWT) a while ago. >
This is true, but brittle to rely on (anything using the SPI like Modules.override() will break equality). It's better to rely on the fact that equivalent bindings get de-duplicated. The one caveat is that to get @Provides methods to de-duplicate, the modules have to compare equal anyway. -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/google-guice. To view this discussion on the web visit https://groups.google.com/d/msgid/google-guice/3a7f8fa3-a19c-45e6-893f-d3ef22ad3404%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
