On Fri, 8 Aug 2025 13:28:50 GMT, Jaikiran Pai <j...@openjdk.org> wrote:
> Can I please get a review of this change which proposes to address the issue > noted in https://bugs.openjdk.org/browse/JDK-8365086? > > `java.net.CookieStore` has some APIs which return a `java.util.List`. These > API are specified to return an immutable `List`. The JDK ships an > implementation of the `CookieStore` - the `java.net.InMemoryCookieStore`. The > implementations of the `getURIs()` and `get(URI)` methods in the > `InMemoryCookieStore` currently return a `List` which is modifiable. > > The changes in this PR fix those two method to return an immutable `List` to > match the specification. A new regression test has been introduced to > reproduce the issue and verify the fix. > > I think this may not require a CSR since this fixes the implementation to > match the already existing specification in `CookieStore`. I will create one > if anyone suggests we should. Marked as reviewed by vyazici (Committer). test/jdk/java/net/CookieStoreTest.java line 45: > 43: * @run junit CookieStoreTest > 44: */ > 45: class CookieStoreTest { Otherwise you get a warning that the comment block should start with a `/**`: Suggestion: class CookieStoreTest { test/jdk/java/net/CookieStoreTest.java line 110: > 108: // an element must fail > 109: assertThrows(UnsupportedOperationException.class, () -> > cookies.add(cookie)); > 110: assertThrows(UnsupportedOperationException.class, () -> > cookies.remove(cookie)); Nit: You can consider factoring this out to a `assertCookieStoreIsImmutable(CookieStore)` method. ------------- PR Review: https://git.openjdk.org/jdk/pull/26698#pullrequestreview-3100989703 PR Review Comment: https://git.openjdk.org/jdk/pull/26698#discussion_r2263087979 PR Review Comment: https://git.openjdk.org/jdk/pull/26698#discussion_r2263088219