class Context {

  static CancellableContext cancellableAncestor(Context parent) {
    if (parent == null) {
      return null;
    }
    if (parent instanceof CancellableContext) {
      return (CancellableContext) parent;
    }
    // The parent simply cascades cancellations.
    // Bypass the parent and reference the ancestor directly (may be null).
    return parent.cancellableAncestor;
  }

  private  Context(PersistentHashArrayMappedTrie<Key<?>, Object> keyValueEntries, int generation);
  private  Context(Context parent, PersistentHashArrayMappedTrie<Key<?>, Object> keyValueEntries);

}