RFR: 8344079: Minor fixes and cleanups to compiler lint-related code [v4]
Maurizio Cimadamore
mcimadamore at openjdk.org
Mon Dec 2 10:09:41 UTC 2024
On Sat, 30 Nov 2024 17:35:56 GMT, Archie Cobbs <acobbs at openjdk.org> wrote:
>> Please review these changes with some minor lint-related fixes and cleanups.
>>
>> See [JDK-8344079](https://bugs.openjdk.org/browse/JDK-8344079) for a more detailed description.
>
> Archie Cobbs has updated the pull request incrementally with one additional commit since the last revision:
>
> Address review comment by being less Streamy.
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java line 446:
> 444: EnumSet<LintCategory> result = LintCategory.newEmptySet();
> 445: Attribute.Array values = (Attribute.Array)suppressWarnings.member(names.value);
> 446: for (Attribute value : values.values) {
I think this loop is more stream-friendly - e.g. you start from `values.values` then:
* `flatMap` using `Optional.of(value).stream()`
* `map` (using `LintCategory::get`, as now)
* `collect` to a new enum set
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22056#discussion_r1865571144
More information about the compiler-dev
mailing list