Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There has been a lot of discussion on this kind of thing. One of the proposals for value types is to have them be immutable.

As to what to do in the meantime - I would suggest that you use either findbugs' immutability detection or Graham Allen's Mutability Detector: https://github.com/MutabilityDetector/MutabilityDetector. Findbugs picks up an @Immutable annotation and checks whether this is the case, whilst Mutability Detector allows you to assert that classes are immutable as part of your unit tests.

I appreciate its not as good as language support, but it is better than relying on an unchecked convention.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: