On 09/09/10 15:23, Brian Pontarelli wrote: > > On Sep 9, 2010, at 3:22 AM, Aekold wrote: > >> Hi All! >> >> Are there any reasons why @interface Singleton does not have >> @Inherited annotation? If no - maybe it's not too late to add it to >> Guice 3.0? Just made abstract servlet for GWT services and thought >> that only one @Singleton will be enough, but it's not... > > Extending from a singleton class has a code smell to me. Not sure that's a > good idea even if the annotation supported it.
If you extend a singleton class you're already violating the singleton nature declared on the base. Thus, it doesn't seem unreasonable to require that you redeclare the @Singleton if it is your true intent that the child be a singleton too. If it were made @Inherited, Guice would need extra code to permit overriding an @Inherited scope with one further down the inheritance hierarchy. Max.
signature.asc
Description: OpenPGP digital signature
