{@inheritdoc}

@throws RuntimeException If a circular reference is detected.
762990
public function getIdsDependingOn($id)
    {
        $resolved = [];
        $unresolved = [];
        $this->dependencyResolve($id, $resolved, $unresolved);

        return array_keys($resolved);
    }
689131
protected function isCircularReference($object, &$context)
    {
        $objectHash = spl_object_hash($object);

        $circularReferenceLimit = $context[self::CIRCULAR_REFERENCE_LIMIT] ?? $this->defaultContext[self::CIRCULAR_REFERENCE_LIMIT] ?? $this->circularReferenceLimit;
        if (isset($context[self::CIRCULAR_REFERENCE_LIMIT_COUNTERS][$objectHash])) {
            if ($context[self::CIRCULAR_REFERENCE_LIMIT_COUNTERS][$objectHash] >= $circularReferenceLimit) {
                unset($context[self::CIRCULAR_REFERENCE_LIMIT_COUNTERS][$objectHash]);

                return true;
            }

            ++$context[self::CIRCULAR_REFERENCE_LIMIT_COUNTERS][$objectHash];
        } else {
            $context[self::CIRCULAR_REFERENCE_LIMIT_COUNTERS][$objectHash] = 1;
        }

        return false;
    }
765788
@GuardedBy("evictionLock")
  void drainValueReferences() {
    if (!collectValues()) {
      return;
    }
    Reference<? extends V> valueRef;
    while ((valueRef = valueReferenceQueue().poll()) != null) {
      @SuppressWarnings("unchecked")
      InternalReference<V> ref = (InternalReference<V>) valueRef;
      Node<K, V> node = data.get(ref.getKeyReference());
      if ((node != null) && (valueRef == node.getValueReference())) {
        evictEntry(node, RemovalCause.COLLECTED, 0L);
      }
    }
  }
763045
public function resolveReferences(ReferenceContext $context = null)
    {
        foreach ($this->_properties as $property => $value) {
            if ($value instanceof Reference) {
                $this->_properties[$property] = $value->resolve($context);
            } elseif ($value instanceof SpecObjectInterface) {
                $value->resolveReferences($context);
            } elseif (is_array($value)) {
                foreach ($value as $k => $item) {
                    if ($item instanceof Reference) {
                        $this->_properties[$property][$k] = $item->resolve($context);
                    } elseif ($item instanceof SpecObjectInterface) {
                        $item->resolveReferences($context);
                    }
                }
            }
        }
    }
1195114
public function release()
    {
        if ($this->semaphoreId) {
            $released = sem_release($this->semaphoreId);
            $this->semaphoreId = null;

            if (!$released) {
                throw new \RuntimeException('Failed to release lock.');
            }
        }
    }
1159772
@Override
  public void process(Node externs, Node root) {
    checkState(compiler.getLifeCycleStage().isNormalized());
    if (!allowRemovalOfExternProperties) {
      referencedPropertyNames.addAll(compiler.getExternProperties());
    }
    traverseAndRemoveUnusedReferences(root);
    // This pass may remove definitions of getter or setter properties.
    GatherGettersAndSetterProperties.update(compiler, externs, root);
  }
1040946
public function release()
    {
        if ($this->handle) {
            $released = flock($this->handle, LOCK_UN);
            fclose($this->handle);
            $this->handle = null;

            if (!$released) {
                throw new \RuntimeException('Failed to release lock.');
            }
        }
    }
552955
function parseCircular(object) {
  // if circular references are disabled, just return the refs object
  if (!config().circularRefs) {
    return object;
  }

  let pointerPath = parsePointer(object.$ref);

  // validate whether the path corresponds with current stack
  for (let i = 0; i < pointerPath.length; i++) {
    if (pointerPath[i] !== path[i]) {
      throw new Error('Invalid circular reference "' +  object.$ref + '"');
    }
  }

  return stack[pointerPath.length];
}
887760
public function get($name, $paramsOverride = array())
    {
        $key             = $this->makeKey($name);
        $descriptor      = $this->describe($name);
        $reflectionClass = $descriptor->getReflectionClass();
        $class           = $reflectionClass->getName();

        if (in_array($class, $this->queue)) {
            $parent = end($this->queue);

            throw new CircularReferenceException("Circular dependency found for class '$class' in class '$parent'. Please use a setter method to resolve this.");
        }

        array_push($this->queue, $class);

        $params = $descriptor->getParams();

        if (!empty($paramsOverride)) {
            $paramsKeys     = array_map(array($descriptor, 'resolveParamName'), array_keys($paramsOverride));
            $paramsOverride = array_combine($paramsKeys, $paramsOverride);
            $params         = array_replace($params, $paramsOverride);
        }

        $args = $this->resolveParams($params);

        array_pop($this->queue);

        if ($descriptor->isShared() && isset($this->instances[$key])) {
            return $this->instances[$key];
        }

        if ($descriptor->isCloneable() && isset($this->instances[$key])) {
            return clone $this->instances[$key];
        }

        if (!$reflectionClass->isInstantiable()) {
            throw new RuntimeException("Class '$class' is is not instantiable");
        }

        $this->instances[$key] = null;

        if (empty($args)) {
            $instance = $reflectionClass->newInstance();
        }
        else {
            $instance = $reflectionClass->newInstanceArgs($args);
        }

        $this->instances[$key] = $instance;

        $this->executeActions($descriptor->getActions(), $this->instances[$key]);

        return $instance;
    }
634673
@Override
  public void afterExitScope(NodeTraversal t, ReferenceMap referenceMap) {
    Node scopeRoot = t.getScopeRoot();
    if (scopeRoot.isBlock() && scopeRoot.getParent().isFunction()) {
      boolean changed = false;
      for (Var v : t.getScope().getVarIterable()) {
        ReferenceCollection references = referenceMap.getReferences(v);
        Reference declaration = null;
        Reference assign = null;
        for (Reference r : references) {
          if (r.isVarDeclaration()
              && NodeUtil.isStatement(r.getNode().getParent())
              && !r.isInitializingDeclaration()) {
            declaration = r;
          } else if (assign == null
              && r.isSimpleAssignmentToName()
              && r.getScope().getClosestHoistScope().equals(t.getScope())) {
            assign = r;
          }
        }
        if (declaration != null && assign != null) {
          Node lhs = assign.getNode();
          Node assignNode = lhs.getParent();
          if (assignNode.getParent().isExprResult()) {
            Node rhs = lhs.getNext();
            assignNode
                .getGrandparent()
                .replaceChild(assignNode.getParent(), IR.var(lhs.detach(), rhs.detach()));

            Node var = declaration.getNode().getParent();
            checkState(var.isVar(), var);
            NodeUtil.removeChild(var, declaration.getNode());

            changed = true;
          }
        }
      }

      if (changed) {
        t.reportCodeChange();
      }
    }
  }
742642
protected function checkCircularReferences($name, \Closure $definition)
    {
        $arguments  = $this->getServiceArgumentNames($definition);

        if (in_array($name, $arguments, true)) {
            throw new \InvalidArgumentException('Circular exception detected');
        }
    }
852860
def circular_references(self) -> Set[str]:
        
        rval = set()
        for k in self.grammarelts.keys():
            if k in self.dependency_closure(k):
                rval.add(k)
        return rval
692296
public function commit()
    {
        try {
            $this->persistenceHandler->commit();
        } catch (Exception $e) {
            throw new RuntimeException($e->getMessage(), 0, $e);
        }
    }
297453
public function tell()
    {
        if ($this->stream === null || ($position = ftell($this->stream)) === false) {
            throw new RuntimeException('Could not get the position of the pointer in stream');
        }

        return $position;
    }
409946
public function onBeforeWrite()
    {
        parent::onBeforeWrite();
        // Check that PlaceableObject with is_main has been set.
        $this->HasMain = false;
        foreach ($this->Regions() as $region) {
            if ($region->IsMain) {
                $this->HasMain = true;
                continue;
            }
            if ($region->hasMethod('Blocks') && $region->Blocks()->exists()) {
                foreach ($region->Blocks() as $block) {
                    if ($block->IsMain) {
                        $this->HasMain = true;
                        continue;
                    }
                }
            }
        }
    }
490642
public function escribirCerrar()
    {
        if (!$this->iniciado) {
            throw new \RuntimeException('La sesión no fue iniciada previamente.');
        }

        if (!$this->adaptador->escribir($this->id, $this->datos)) {
            throw new \RuntimeException('Hubo un error escribiendo la sesión.');
        }

        $this->adaptador->cerrar();
        $this->iniciado = false;

        return true;
    }
598863
private boolean isGuardedInstanceofReference(Node reference) {
    Node instanceofNode = reference.getParent();
    if (isInstanceofFor(instanceofNode, reference)) {
      Node andNode = instanceofNode.getParent();
      return andNode != null
          && andNode.isAnd()
          && isUndefinedTypeofGuardFor(andNode.getFirstChild(), reference);
    } else {
      return false;
    }
  }