RFR: 8376582: Remove assert from default method in java.util.zip.Checksum interface

Eirik Bjørsnøs eirbjo at openjdk.org
Wed Jan 28 14:28:38 UTC 2026


On Wed, 28 Jan 2026 14:14:42 GMT, Eirik Bjørsnøs <eirbjo at openjdk.org> wrote:

> I assume the intention was to mutation of buffer in another thread.

Not sure if you are just providing context here or you mean the `assert` is worth keeping.

If the latter is the case, I guess we could always code something up manually:


// Avoiding assert keyword here to prevent generating nested synthetic class
if (pos > limit && Checksum.class.desiredAssertionStatus()) {
    throw new AssertionError("Concurrent modification of ByteBuffer");
}

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29466#discussion_r2736893425


More information about the core-libs-dev mailing list