public void setSpanNode(SpanNode spanNode) {
        if (this.spanNode != null && spanNode != null) {
            throw new IllegalStateException("WARNING! " + this + " is already attached to node " + this.spanNode
                                            + ". Attempt to attach to node " + spanNode
                                            + ". Annotation instances MUST NOT be shared among SpanNodes.");
        }
        if (spanNode != null && !spanNode.isValid()) {
            throw new IllegalStateException("Span node is invalid: " + spanNode);
        }
        if (spanNode == DummySpanNode.INSTANCE) {
            // internal safeguard
            throw new IllegalStateException("BUG! Annotations should never be attached to DummySpanNode.");
        }
        this.spanNode = spanNode;
    }
WARNING! Should only be used by deserializers! Sets the span node that this annotation points to.

@param spanNode the span node that this annotation shall point to.
document/src/main/java/com/yahoo/document/annotation/Annotation.java