Issue 245: Guice should refuse to inject final fields
http://code.google.com/p/google-guice/issues/detail?id=245

Comment #1 by robbie.vanbrabant:
As Bob once pointed out on the mailing list, it could make sense to @Inject  
private
finals (e.g. into providers) because you get the same thread  
safety/visibility
guarantees as you get with constructors:  
http://jeremymanson.blogspot.com/2008/07/immutability-in-java-part-3.html

I have currently used this in Warp Persist, here:  
http://code.google.com/p/warp-
persist/source/browse/trunk/warp-
persist/src/com/wideplay/warp/hibernate/SessionFactoryProvider.java

We can't let Guice create the object, but still want to use a final field.  
It seemed
like the only way to do that.

Now, Guice 2.0's getProvider will probably get rid of this use case, so in  
that case
I'm not against removing support for this, because it sure does feel hacky.




-- 
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"google-guice-dev" 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-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to