Documentation of AudioProcessorGraph::addNode() with nodeID wrong?

The documentation for addNode() with nodeID argument appears to be wrong.

https://docs.juce.com/master/classAudioProcessorGraph.html#a4e0ec59179dcc641da9351eb8ae1aa49

It says:

The optional nodeID parameter lets you specify an ID to use for the node, but if the value is already in use, this new node will overwrite the old one.

…but in the code, it will not let you overwrite an existing nodeID, it asserts and returns:


AudioProcessorGraph::Node::Ptr AudioProcessorGraph::addNode (std::unique_ptr<AudioProcessor> newProcessor, NodeID nodeID)
{
    if (newProcessor == nullptr || newProcessor.get() == this)
    {
        jassertfalse;
        return {};
    }

    if (nodeID == NodeID())
        nodeID.uid = ++(lastNodeID.uid);

    for (auto* n : nodes)
    {
        if (n->getProcessor() == newProcessor.get() || n->nodeID == nodeID)
        {
            jassertfalse; // Cannot add two copies of the same processor, or duplicate node IDs!
            return {};
        }
    }

    if (lastNodeID < nodeID)
        lastNodeID = nodeID;

    newProcessor->setPlayHead (getPlayHead());

    Node::Ptr n (new Node (nodeID, std::move (newProcessor)));
    nodes.add (n.get());
    n->setParentGraph (this);
    topologyChanged();
    return n;
}

I thought you could replace an existing node and keep the same nodeID, but apparently not…

Thanks, we’ll get the documentation updated to reflect what the method actually does.