On Thu, 19 Oct 2023 15:21:55 GMT, Calvin Cheung <cche...@openjdk.org> wrote:
>> Please review this changeset for adding support for `--module` (-m) option >> for CDS. >> Changes in the `ModuleBootstrap.java` are needed so that the >> `ArchivedModuleGraph.archive` and `ArchivedBootLayer.archive` are called if >> the main module is specified. The module name will be stored in the ro >> region of the CDS archive. During runtime, the archived module name will be >> compared with the runtime module name. If comparison fails, the archived >> full module graph won't be used. >> >> Note: this RFE is a subtask of >> [JDK-8266329](https://bugs.openjdk.org/browse/JDK-8266329). More subtask(s) >> will be created to support other options such as `--add-modules`. >> >> Passed tiers 1 - 4 testing. > > Calvin Cheung has updated the pull request incrementally with one additional > commit since the last revision: > > simplify some code in modules.cpp src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java line 481: > 479: canArchive = true; > 480: } > 481: } An alternative to avoid the 3 levels of if expressions is to use: String scheme = systemModuleFinder.find(mainModule) .stream() .map(ModuleReference::location) .flatMap(Optional::stream) .findAny() .map(URI::getScheme) .orElse(null); if ("jrt".equalsIgnoreCase(scheme)) { canArchive = true; } ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/16016#discussion_r1367104266