On Fri, 27 Sep 2024 11:11:20 GMT, Alan Bateman <al...@openjdk.org> wrote:
> Do you remember why resetArchivedStates resets the resource cache? I would > expected it to be cleared for all class loaders. > I think it is because `resourceCache` is a `SoftReference` and it will fail the check in `JavaClasses::is_supported_for_archiving()`. > Rather than putting something specific to the app class loader here then > maybe it should be renamed and have resetArchivedStates call it, e.g. > > ``` > void resetArchivedStates(boolean all) { > ucp = null; > resourceCache = null; > if (all) { > moduleToReader.clear(); > } > } > ``` Under `if(all)`, we also need to do `setClassPath(null)`. If I understand your suggestion correctly, in `BuiltinClassLoader`: private void resetArchivedStates() { resetArchivedStates(false); } In `ClassLoaders.AppClassLoader`: private void resetArchivedStates() { resetArchivedStates(true); } ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/21048#discussion_r1778944555