RFR: 8338686: App classpath mismatch if a jar from the Class-Path attribute is on the classpath
David Holmes
dholmes at openjdk.org
Mon Sep 9 03:48:06 UTC 2024
On Fri, 23 Aug 2024 22:20:56 GMT, Calvin Cheung <ccheung at openjdk.org> wrote:
> When a CDS archive is created with `-cp jarA:jarB` where the manifest of jarA contains a class-path attribute (e.g. `Class-Path: jarA1`). The following paths will be stored in the archive: jarA jarA1 jarB.
>
> Currently, during runtime, if the user specifies `-cp jarA:jarA1:jarB`, it will result in class path mismatch and the archive will not be used. This patch addresses this issue to allow the user specifies jar files in the class-path attribute during runtime.
>
> Testing: tiers 1 - 5.
Seems reasonable. A few style nits.
Thanks
src/hotspot/share/cds/filemap.cpp line 869:
> 867: int rp_len = num_paths(appcp);
> 868: bool mismatch = false;
> 869: if ((rp_len < shared_app_paths_len)) {
Please remove added parentheses
src/hotspot/share/cds/filemap.cpp line 870:
> 868: bool mismatch = false;
> 869: if ((rp_len < shared_app_paths_len)) {
> 870: log_info(class, path)("App classpath lengths (dumptime: %d expanded(including jars in Class-Path attribute) %d, runtime: %d)",
Nit: space after "expanded" please
src/hotspot/share/cds/filemap.cpp line 887:
> 885: // are the same initially, after the call to create_path_array(), the runtime app classpath length could become
> 886: // shorter. We consider app classpath mismatch in this case.
> 887: log_info(class, path)("App classpath lengths (dumptime: %d expanded(including jars in Class-Path attribute) %d, runtime: %d)",
Nit: space after "expanded" please
test/hotspot/jtreg/runtime/cds/appcds/ClassPathAttr.java line 151:
> 149: .assertNormalExit(output -> {
> 150: output.shouldContain("Hello source: shared objects file");
> 151: });
Style nit here and elsewhere:
Suggestion:
TestCommon.run("-Xlog:class+path,class+load",
"-cp", cp,
"Hello")
.assertNormalExit(output -> {
output.shouldContain("Hello source: shared objects file");
});
-------------
PR Review: https://git.openjdk.org/jdk/pull/20697#pullrequestreview-2259519605
PR Review Comment: https://git.openjdk.org/jdk/pull/20697#discussion_r1730528078
PR Review Comment: https://git.openjdk.org/jdk/pull/20697#discussion_r1730530594
PR Review Comment: https://git.openjdk.org/jdk/pull/20697#discussion_r1730532335
PR Review Comment: https://git.openjdk.org/jdk/pull/20697#discussion_r1749517898
More information about the hotspot-runtime-dev
mailing list