RFR: 8199318: add idempotent copy operation for Map.Entry
Rémi Forax
forax at openjdk.java.net
Wed Jun 2 17:24:30 UTC 2021
On Wed, 2 Jun 2021 17:12:21 GMT, Stuart Marks <smarks at openjdk.org> wrote:
> A quick search reveals that Guava has a public subclass of SimpleImmutableEntry:
> https://guava.dev/releases/30.1.1-jre/api/docs/com/google/common/cache/RemovalNotification.html
>There are possibly others. It doesn't seem worth the incompatibility to me, as it would break stuff in order to have only a "cleaner" meaning for "immutable." Also, there are other classes in the JDK that claim they are immutable but which can be subclassed, e.g., BigInteger. I don't see a good way of fixing this.
Thanks, i've done some digging too,
I foolishly hoped that nobody would subclass a class with `Immutable` in its name,
oh boy i was wrong :)
So documenting the existing behavior seems the only possible way.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4295
More information about the core-libs-dev
mailing list