Repository: jenkinsci/jenkins
File: core/src/main/java/jenkins/model/Jenkins.java (Java)

Code before:

    protected void updateNewComputer(Node n) {
        updateNewComputer(n, AUTOMATIC_AGENT_LAUNCH);
    }

    /**
     * Update the list of computers that are running on this Jenkins instance.
     * Consider {@link #updateComputers(Node...)} instead if you know what nodes needs to be updated.
     * @see #updateComputers(Node...)
     */
    protected void updateComputerList() {
        var allNodes = new HashSet<Node>();
        allNodes.add(this);
        allNodes.addAll(getNodes());
        updateComputerList(AUTOMATIC_AGENT_LAUNCH, allNodes);
    }

    /**
     * Update the computers for the given nodes.
     */
    protected void updateComputers(@NonNull Node... nodes) {
        var nodeSet = new HashSet<Node>();
        for (var node : nodes) {
            if (node != null) {
                nodeSet.add(node);
            }
        }
        updateComputerList(AUTOMATIC_AGENT_LAUNCH, nodeSet);
    }

    /** @deprecated Use {@link SCMListener#all} instead. */
    @Deprecated
    public CopyOnWriteList<SCMListener> getSCMListeners() {
        return scmListeners;
    }

    /**
     * Gets the plugin object from its short name.
     * This allows URL {@code hudson/plugin/ID} to be served by the views
     * of the plugin class.
     * @param shortName Short name of the plugin
     * @return The plugin singleton or {@code null} if for some reason the plugin is not loaded.
     *         The fact the plugin is loaded does not mean it is enabled and fully initialized for the current Jenkins session.
     *         Use {@link Plugin#getWrapper()} and then {@link PluginWrapper#isActive()} to check it.
     */
    @CheckForNull
    public Plugin getPlugin(String shortName) {
        PluginWrapper p = pluginManager.getPlugin(shortName);
        if (p == null)     return null;
        return p.getPlugin();
    }

Review comment (bug):
is it legit for someone to pass in a `null` node, seems like this would mask a bug without any warning/error?

```suggestion
            if (node != null) {
                nodeSet.add(node);
            } else {
                LOGGER.log(WARNING, "A null node was passed to updateComputers", new Throwable("null is not valid"));
            }
```

Code after:

    protected void updateNewComputer(Node n) {
        updateNewComputer(n, AUTOMATIC_AGENT_LAUNCH);
    }

    /**
     * Update the list of computers that are running on this Jenkins instance.
     * Consider {@link #updateComputers(Node...)} instead if you know what nodes needs to be updated.
     * @see #updateComputers(Node...)
     */
    protected void updateComputerList() {
        var allNodes = new HashSet<Node>();
        allNodes.add(this);
        allNodes.addAll(getNodes());
        updateComputerList(AUTOMATIC_AGENT_LAUNCH, allNodes);
    }

    /**
     * Update the computers for the given nodes.
     */
    protected void updateComputers(@NonNull Node... nodes) {
        var nodeSet = new HashSet<Node>();
        Collections.addAll(nodeSet, nodes);
        updateComputerList(AUTOMATIC_AGENT_LAUNCH, nodeSet);
    }

    /** @deprecated Use {@link SCMListener#all} instead. */
    @Deprecated
    public CopyOnWriteList<SCMListener> getSCMListeners() {
        return scmListeners;
    }

    /**
     * Gets the plugin object from its short name.
     * This allows URL {@code hudson/plugin/ID} to be served by the views
     * of the plugin class.
     * @param shortName Short name of the plugin
     * @return The plugin singleton or {@code null} if for some reason the plugin is not loaded.
     *         The fact the plugin is loaded does not mean it is enabled and fully initialized for the current Jenkins session.
     *         Use {@link Plugin#getWrapper()} and then {@link PluginWrapper#isActive()} to check it.
     */
    @CheckForNull
    public Plugin getPlugin(String shortName) {
        PluginWrapper p = pluginManager.getPlugin(shortName);
        if (p == null)     return null;
        return p.getPlugin();
    }

    /**
     * Gets the plugin object from its class.
     *