[concurrency-interest] Joda-Time immutability

Mark Thornton mthornton at optrak.com
Mon Jun 20 10:23:11 EDT 2011

On 20/06/11 15:03, Stephen Colebourne wrote:
> The "reflection can set final fields" comment was directed at
> serialization, but has actually provided a reasonably acceptable
> solution (thanks Mark).
> Basically, I've made the fields final, and changed the setters to use
> reflection (breaking the final restriction). Since 99% of use cases
> are immutable, this will only impact the mutable users (a little bit
> slower), and they should really move to the immutable classes
> anyway...
> I'd still like to know if my volatile write/read code posted earlier
> would have been valid.
> Stephen
A potential catch with using reflection is when a SecurityManager is in use.


More information about the Concurrency-interest mailing list