RFR: 6323374: (coll) Optimize Collections.unmodifiable* and synchronized* [v4]

Ian Graves igraves at openjdk.java.net
Tue Feb 23 16:29:59 UTC 2021


On Tue, 23 Feb 2021 16:18:29 GMT, Claes Redestad <redestad at openjdk.org> wrote:

> > Is there any behavior change here that merits a CSR review?
> 
> Maybe. The one observable change is that calling `Collections.bar(foo)` with a `foo` that is already a `bar` will return the instance rather than unnecessarily wrap it. This could change semantics in applications inadvertently or deliberately relying on identity.

Yes. The CSR was to consider primarily this case. Probably out of an abundance of caution here. @stuart-marks may have another case to consider.

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

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


More information about the core-libs-dev mailing list