I am looking for realistic examples of immutable classes developed in Java. In order to allow finding those classes which are intended to be immutable, it would be helpful if the code used an @Immutable
annotation, or otherwise documented classes as intended to be immutable. I also need to be able to study the source code of those classes, so a project with any "read only" license is suitable.
In regards to the @Immutable
annotation used, it doesn't matter which @Immutable
it is. So whether the annotation is from JSR-305 or FindBugs, or in-house, etc., it doesn't matter, just that the simple name of the annotation is "Immutable". Similarly, if the project uses a consistent way of marking classes as immutable (class name convention, javadoc, marker interfaces, etc.) such that I can search the codebase and tell a mutable class from an immutable one, this is also what I'm looking for.
Are there any examples of open-source code containing extensive examples of immutable classes?