001package org.modeshape.common.annotation; 002 003import java.lang.annotation.Documented; 004import java.lang.annotation.ElementType; 005import java.lang.annotation.Retention; 006import java.lang.annotation.RetentionPolicy; 007import java.lang.annotation.Target; 008 009/** 010 * Copyright (c) 2005 Brian Goetz and Tim Peierls.<br /> 011 * Released under the Creative Commons Attribution License<br /> 012 * (http://creativecommons.org/licenses/by/2.5)<br /> 013 * Official home: http://www.jcip.net<br /> 014 * Adopted from Java Concurrency in Practice. 015 * <p> 016 * This annotation documents that instances of the annotated class are immutable. This means that its state is seen to others as 017 * never being changed, even though the actual private internal state may indeed change. Therefore, in an immutable class: 018 * <ul> 019 * <li>all public fields are final; and</li> 020 * <li>all public final reference fields refer to other immutable objects; and</li> 021 * <li>constructors and methods do not publish references to any internal state which is potentially mutable by the 022 * implementation.</li> 023 * </ul> 024 * </p> 025 */ 026@Documented 027@Target( ElementType.TYPE ) 028@Retention( RetentionPolicy.RUNTIME ) 029public @interface Immutable { 030}