On Tue, 30 May 2023 17:37:24 GMT, Mandy Chung <mch...@openjdk.org> wrote:

>> Change `ClassFileDumper` constructor to take a `String` rather than `Path` 
>> to avoid the file system implementation classes loaded during startup.  In 
>> addition, `FilePermission` also causes the default file system to be 
>> initialized. 
>> 
>> This patch changes `ClassFileDumper` to validate the given path only if it's 
>> enabled and not to use limited `doPrivileged` to avoid the initialization of 
>> `FilePermission` class and the file system implementation classes by default.
>> 
>> This patch also changes `ClassFileDumper::write` to use `File` instead of 
>> `Path` because of JDK-8306678.  `OperatingSystem::<clinit>` causes 
>> `Enum::valueOf` to be called which calls core reflection which in turns 
>> invokes method handles.   If 
>> `-Djdk.invoke.MethodHandle.dumpMethodHandleInternals` is set, VM 
>> initialization would fail because `BootLoader::<clinit>` causes 
>> `ClassLoaderHelper` to initialize which in turn causes `OperatingSystem` be 
>> initialized.   If additional LFs are spinned and dumped, if 
>> `ClassFileDumper` uses `Path` for writing, `FileSystems::getDefault` would 
>> fail with `NullPointerException` because it calls `BootLoader.loadLibrary` 
>> which is not fully initialized. 
>> 
>> A separate issue will be filed to follow up the startup overhead of 
>> `OperatingSystem`.
>
> Mandy Chung has updated the pull request with a new target base due to a 
> merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains four additional 
> commits since the last revision:
> 
>  - minor clean up
>  - Revert ClassFileDumper to use Path as JDK-8308960 removed the dependency 
> to Enum::valueOf
>  - Merge branch 'master' of https://github.com/openjdk/jdk into 
> class-file-dumper
>  - 8307944: ClassFileDumper should only load java.nio.file.Path if enabled

Path changes look fine.

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

Marked as reviewed by rriggs (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/14160#pullrequestreview-1451522642

Reply via email to