Yes, I think you're right. My bad. Guice does pick up @Inject annotations from parent methods though (if you override), which had me confused for a moment.
Robbie On Mon, Oct 6, 2008 at 5:15 PM, James Strachan <[EMAIL PROTECTED]>wrote: > > 2008/10/6 Robbie Vanbrabant <[EMAIL PROTECTED]>: > > Is that going to play nice with inheritance? Let's say you have a > > inheritance chain of three levels, and next to a public constructor (with > > args) in the parent type you add a new constructor. Now the two types > below > > have an extra constructor, and Guice will blow up if you use one of them. > > I didn't think guice invoked constructors in sub-classes? I thought it > just invoked the outer-most constructor? If thats true it doesn't make > any difference if the base classes constructors have @Inject > annotations or not. > > > So > > now you have to know that it's actually the parent type that causes the > > other two types to fail (obviously you could also annotate the parent's > > constructor, but you don't always use the parent type with Guice). > > If you derive from a class with 1 non-zero arg contructor; then later > on someone adds another constructor to the base class - you have to > explicitly expose that constructor yourself in the derived class > right? i.e. guice would keep on working fine in the derived class > unless you choose in the derived class to (i) expose another > constructor or (ii) switch the constructor being used > > -- > James > ------- > http://macstrac.blogspot.com/ > > Open Source Integration > http://open.iona.com > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "google-guice" 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?hl=en -~----------~----~----~----~------~----~------~--~---
