Summary of changes:
Before dumping info the archive, all the module names from `--add-modules` will
be sorted and then concatenated into one string with comma as the separator
between module names.
During runtime, same function will be used to obtain the string in the same
format with sorted module names. The string will be compared with the one from
the archive to determine if the same module names were specified during dump
time.
ModuleBootstrap.java
The `addModulesFromRuntimeImage` method is added to check if the
modules in `addModules` are from the runtime image. If any of the modules isn't
in the runtime image, archiving will be disabled.
ArchivedModuleGraph.java
The constructor has an addition argument `Set addModules`
The `get` method also has an addition argument `Set addModules`. It
returns the `archivedModuleGraph` only if both the `mainModule` and the
`addModules` are the same as the input arguments.
Passed tiers 1 - 4 testing.
-------------
Commit messages:
- 8319343: Improve CDS module graph support for --add-modules option
- Merge branch 'master' into 8319343-add-modules
- update test
- Merge
- simplify vm changes
- Merge branch 'master' into 8319343-add-modules
- 8319343: Improve CDS module graph support for --add-modules option
Changes: https://git.openjdk.org/jdk/pull/21553/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=21553&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8319343
Stats: 367 lines in 12 files changed: 346 ins; 3 del; 18 mod
Patch: https://git.openjdk.org/jdk/pull/21553.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/21553/head:pull/21553
PR: https://git.openjdk.org/jdk/pull/21553