1 package javax.annotation.concurrent;
2 
3 import java.lang.annotation.Documented;
4 import java.lang.annotation.ElementType;
5 import java.lang.annotation.Retention;
6 import java.lang.annotation.RetentionPolicy;
7 import java.lang.annotation.Target;
8 
9 /*
10  * Copyright (c) 2005 Brian Goetz
11  * Released under the Creative Commons Attribution License
12  *   (http://creativecommons.org/licenses/by/2.5)
13  * Official home: http://www.jcip.net
14  */
15 
16 /**
17  * Immutable
18  *
19  * The class to which this annotation is applied is immutable. This means that
20  * its state cannot be seen to change by callers. Of necessity this means that
21  * all public fields are final, and that all public final reference fields refer
22  * to other immutable objects, and that methods do not publish references to any
23  * internal state which is mutable by implementation even if not by design.
24  * Immutable objects may still have internal mutable state for purposes of
25  * performance optimization; some state variables may be lazily computed, so
26  * long as they are computed from immutable state and that callers cannot tell
27  * the difference.
28  *
29  * Immutable objects are inherently thread-safe; they may be passed between
30  * threads or published without synchronization.
31  */
32 @Documented
33 @Target(ElementType.TYPE)
34 @Retention(RetentionPolicy.CLASS)
35 public @interface Immutable {
36 }
37