RFR: 8341957: Add test for URLClassLoader loading invalid class with mismatching CRC32

Eirik Bjørsnøs eirbjo at openjdk.org
Sun Oct 13 07:34:08 UTC 2024


On Sun, 13 Oct 2024 07:07:52 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

> .. is merely an implementation detail (which should be free to change any time). I think asserting this internal detail through a test case isn't necessary.

Thanks Jai. Sure, this test asserts invariants of the implementation, not in the specification. There is some precedence for this, consider the CEN size implemenation limit validation testing.  

The context for looking into this was that the CRC checksum is currently computed on the happy path. If we shift this computation to where there is an actual `ClassFormatError`, I observe  a ~10ms improvement on Spring Petclinic startup time on my computer. Given the complexity and sensitivity of this area, I would not be comfortable proposing such a change without having a solid test to catch regressions.

But yeah, the performance improvement isn't major, and the details of the the suppressed message is probably not very important for users.

I'll withdraw this PR.

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

PR Comment: https://git.openjdk.org/jdk/pull/21469#issuecomment-2408861628


More information about the core-libs-dev mailing list