[NETBEANS-5659] Collection.forEach is always a read from the collection. #6646
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Having code like:
will mark the List as unbalanced - only written to, never read. The hint lists the
forEach
method in the list of read methods, but for (ordinary) read methods, the hint also requires the return value of the read method to be used.forEach
is a bit different in this regard, it runs the lambda for the elements, but does not return anything.This PR introduces a new
STANDALONE_READ_METHODS
, which do not require their return value to be used.It also adds the JEP 431: Sequenced Collections from JDK 21 method names.
Filling with NB20 and against
delivery
, but no strong opinions on this. I am fine with moving this tomaster
/NB21.