On Sun, 29 Sep 2024 06:43:42 GMT, Alan Bateman <[email protected]> wrote:
>> Why does it need to clear `moduleToReader` only for app loader and not for
>> platform loader? Is it because the `moduleToReader` for the app loader may
>> contain reference to jar files that indirectly references some file system
>> objects?
>>
>> Since moduleToReader is just a cache, I think it's better to always clear it
>> for both loaders. Also, the logic can be moved into BuiltinClassLoader:
>>
>>
>> class BuiltinClassLoader {
>> ....
>> private void resetArchivedStates() {
>> ucp = null;
>> resourceCache = null;
>> setClassPath(null); // AppClassLoader will initialize this
>> again at runtime.
>> moduleToReader.clear();
>> }
>
> setClassPath(null) is the same as `ucp = null` but yes, keep it simple as
> otherwise there will be question each time there are changes.
> BuiltinClassPath should not include any code that is specific to the app
> class loader or the platform class loader as there are specific subclasses
> for that.
Ok. I've simplified the fix as suggested.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21048#discussion_r1783230382