Issue 245: Guice should refuse to inject final fields
http://code.google.com/p/google-guice/issues/detail?id=245
New issue report by limpbizkit:
Setting final fields directly using reflection has unpredictable results
and shouldn't be supported.
From the Field.set() Javadoc:
If the underlying field is final, the method throws an
IllegalAccessException unless
setAccessible(true) has succeeded for this field and this field is
non-static. Setting a final field in
this way is meaningful only during deserialization or reconstruction of
instances of classes with
blank final fields, before they are made available for access by other
parts of a program. Use in any
other context may have unpredictable effects, including cases in which
other parts of a program
continue to use the original value of this field.
I believe we still need setAccessible(true) so we can update modify private
non-final fields.
Issue attributes:
Status: New
Owner: limpbizkit
Labels: Type-Defect Priority-Medium Milestone-Release2.0
--
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
-~----------~----~----~----~------~----~------~--~---