@Retention(CLASS) @Target(TYPE_USE) public @interface Unowned
If field members or local variables are annotated, they will not have ownership on the referenced object, and their references will not be included in the referenced object's reference count.
This class supports annotation for the following common data structures: Doubly Linked List, TreeMap, and Linked HashMap.
Incorrect use of this class may result in an early release of the referenced object.
Take TreeMap data structure as an example, the parent node can be annotated as Unowned, but the left and right node can not be annotated:
static final class TreeMapEntry<K,V> implements Map.Entry<K,V> {
K key;
V value;
TreeMapEntry<K,V> left;
TreeMapEntry<K,V> right;
@Unowned
TreeMapEntry<K,V> parent;
boolean color = BLACK;
...;
}