> The "Why Constructors?" section makes me nervous, though. To say, as you 
> do in the first bullet, that a constructor "is the one guaranteed 
> thread-safe unsynchronized method an object can have" makes it sound as 
> though you don't need to worry about safe publication of the object being 
> constructed as long as you don't leak "this". But you only get the 
> guarantee that other threads will see completely initialized values of *
> final* fields. (See 
> http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#d5e28755 for 
> an example.)
>

Yeah, you're right.  I'm so unused to using non-final fields, I forget that 
most of the world was weaned on JavaBeans :-)
 

> And you don't mention one of the big drawbacks of constructors, which is 
> that you can't in general safely call overridden methods in constructor 
> bodies.
>

Also true - IMO, 99% of the time anything you want people to override 
should be abstract and the rest should be final, but people do that too. 
 The dangers of coding for an audience that is yourself :-)
 

>
> That said, I think the Guice abuse is very cool.
>

Thanks!

-Tim 

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to