RFR: 8275242: Remove redundant stream() call before forEach in jdk.compiler

Jonathan Gibbons jjg at openjdk.java.net
Wed Oct 13 19:03:09 UTC 2021


On Wed, 15 Sep 2021 07:24:35 GMT, Andrey Turbanov <duke at openjdk.java.net> wrote:

> There are several places in the jdk.compiler, jdk.javadoc, jdk.jshell that use stream().forEach(...), these can be cleaned up.
> Instead Collection.forEach or Map.forEach can be used directly.
> This is continuation of
> 1. [JDK-8273710](https://bugs.openjdk.java.net/browse/JDK-8273710) Remove redundant stream() call before forEach in jdk.jdeps
> 2. [JDK-8273711](https://bugs.openjdk.java.net/browse/JDK-8273711) Remove redundant stream() call before forEach in jdk.jlink

jdk.compiler and jdk.javadoc changes look OK.

src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java line 1645:

> 1643:                     for (RecordComponent rc : recordComponents) {
> 1644:                         List<JCAnnotation> originalAnnos = rc.getOriginalAnnos();
> 1645:                         originalAnnos.forEach(this::visitAnnotation);

while not wrong, this is not covered in the description of the PR

-------------

PR: https://git.openjdk.java.net/jdk/pull/5521


More information about the compiler-dev mailing list