Annotation Interface Immutable


@Retention(CLASS) @Target(TYPE) public @interface Immutable
Marks a class whose instances cannot change after construction: all fields are final, referenced arrays and collections are private copies that never escape, and every method that sounds like a mutator (add..., with...) returns a new value instead.

SpotBugs reads any annotation named Immutable and then stops treating references to the class as exposed internal state. Put it only on classes that meet the contract above. Not @Documented: the package is not exported, so the marker stays out of the published javadoc.