JarFile.getVersionedEntry scalability with new release cadence

Eirik Bjørsnøs eirbjo at gmail.com
Fri Apr 10 18:59:06 UTC 2020

I recently needed to re-implement multi-release lookup logic for a
ModuleReader capable of reading modules from unpacked (exploded) jar files

It occurred to me that JarFile.getVersionedEntry checks _every_ version
between 8 and the runtime version when looking up paths.

Since META-INF/versions will probably be sparsely populated, I'm wondering
if something could be done to avoid checking 20 different paths in OpenJDK

Perhaps scanning META-INF/versions once when opening the file could work,
then only check existing versions in getVersionedEntry?

Maybe a premature optimization today, but with the new release cadence,
this problem is going to surface at some point in the future, right?



More information about the core-libs-dev mailing list