01: package net.jcip.annotations;
02:
03: import java.lang.annotation.Documented;
04: import java.lang.annotation.ElementType;
05: import java.lang.annotation.Retention;
06: import java.lang.annotation.RetentionPolicy;
07: import java.lang.annotation.Target;
08:
09: /*
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 performance
25: * optimization; some state variables may be lazily computed, so long as they are computed
26: * from immutable state and that callers cannot tell the difference.
27: *
28: * Immutable objects are inherently thread-safe; they may be passed between threads or
29: * published without synchronization.
30: */
31: @Documented
32: @Target(ElementType.TYPE)
33: @Retention(RetentionPolicy.CLASS)
34: public @interface Immutable {
35: }
|