RFR: 8282662: Use List.of() factory method to reduce memory consumption [v3]
Сергей Цыпанов
duke at openjdk.java.net
Tue Mar 29 09:51:42 UTC 2022
On Sat, 26 Mar 2022 16:35:14 GMT, liach <duke at openjdk.java.net> wrote:
>> Сергей Цыпанов has updated the pull request incrementally with one additional commit since the last revision:
>>
>> 8282662: Revert dubious changes in MethodType
>
> Just curious, this issue asks to replace set constructions with `Set.of`, but there is no such code changes in this pull request. Is there any set creation patterns that aren't detected by your ide cleanups, such as `Collections.addAll(set, elements)` for creating hash set contents from array?
@liach I've found a couple of places:
- `AsynchronousFileChannel.open()`
- `FileChannel.open()`
- `DecimalStyle.getAvailableLocales()`
They all either rely on user input, i.e. might throw NPE or IAE for nulls or duplicates respectively, or return the set, which is currently modifiable `HashSet`. I think the possible win isn't worth the effort.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7729
More information about the security-dev
mailing list