RFR: 8281289: Improve with List.copyOf
Xue-Lei Andrew Fan
xuelei at openjdk.java.net
Sat Feb 5 20:34:10 UTC 2022
On Sat, 5 Feb 2022 13:22:25 GMT, Claes Redestad <redestad at openjdk.org> wrote:
> There's a small compatibility risk with this change, e.g., `List.copyOf(...).contains(null)` will throw NPE while `Collections.unmodifiableList(...).contains(null)` won't.
>
> If we accept that compatibility risk (which should probably be decided by CSR) it might also make sense to use `List.of()` for the empty case, which will reduce the number of List implementation classes returned from the API.
All GOOD points! Thanks!
I filed a new JDK-8281298, and a new [pull request](https://github.com/openjdk/jdk/pull/7359).
-------------
PR: https://git.openjdk.java.net/jdk/pull/7356
More information about the security-dev
mailing list