RFR: 8331467: FileSystems.getDefault fails with ClassNotFoundException if custom default provider is in run-time image [v9]

Alan Bateman alanb at openjdk.org
Thu Dec 19 12:38:29 UTC 2024


On Thu, 19 Dec 2024 12:35:39 GMT, liyazzi <duke at openjdk.org> wrote:

>> For two cases:
>> 
>> 1. When the ImageReaderFactory was loaded by local jdk,that means the ImageReaderFactory was loaded by boot class loader,then init the `Path BOOT_MODULES_JIMAGE` by using `sun.nio.fs.DefaultFileSystemProvider` which is obtained through reflection,due to it is in jdk internal.
>> 2. When loaded by a target jdk, such as jdk8 runtime, then use the Java 8 compatible APIs: `FileSystems.getDefault()` to init the `BOOT_MODULES_JIMAGE` field.
>> Then we can avoid the circular dependencies in class loading caused by loading the defaultSystemProvider.
>
> liyazzi has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Update the date of 'ImageReaderFactory'
>  - Update the date of 'ImageReaderFactory' and remove the import of 'Disabled' in SetDefaultProvider test

src/java.base/share/classes/jdk/internal/jimage/ImageReaderFactory.java line 2:

> 1: /*
> 2:  * Copyright (c) 2015, 2016, 2024, Oracle and/or its affiliates. All rights reserved.

It should be changed to "2015, 2024,"

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22628#discussion_r1891877856


More information about the core-libs-dev mailing list