On Thu, 10 Apr 2025 16:04:59 GMT, Ioi Lam <ik...@openjdk.org> wrote: >> Timofei Pushkin has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Remove findClass, extend explanation comments > > test/hotspot/jtreg/runtime/cds/appcds/customLoader/ClassFromClasspath.java > line 53: > >> 51: out.shouldContain("unreg CustomLoadee"); >> 52: } >> 53: } > > For completeness, I think we should have a more complicated scenario: > > - load CustomLoadee in both the app loader and a custom loader > - load CustomLoadeeChild in the custom loader. Its super class should be the > one defined in the custom loader > > At run time, verify that CustomLoadeeChild is archived and its super class is > defined in the custom loader
This case will work, I've added the test, however I found another case which won't be handled correctly, neither before nor after this change. This is the case you've suggested, it works fine both before and after the change. java/lang/Object id: 0 CustomLoadee3 id: 1 CustomLoadee3 id: 2 super: 0 source: a.jar CustomLoadee3Child id: 3 super: 2 source: a.jar However the below one doesn't work neither before nor after this change. At dump time, 2 is loaded instead of 1 as the super of 3 because 2, 3 are loaded by the same class loader and 1, 2 have the same name. It is possible to get such class list if 2 is loaded by a non-delegating unregistered loader while 3 is loaded by a different delegating one. # Difference with the previous: super of the last class java/lang/Object id: 0 CustomLoadee3 id: 1 CustomLoadee3 id: 2 super: 0 source: a.jar CustomLoadee3Child id: 3 super: 1 source: a.jar And the following case is working without this change but will not work with it. It is working now because there will be two different unregistered loaders for classes 2 and 3 (because they have the same source), however with this change there will be one and it will re-use 2 already loaded by it when loading 3. # Difference with the previous: source of the last class java/lang/Object id: 0 CustomLoadee3 id: 1 CustomLoadee3 id: 2 super: 0 source: a.jar CustomLoadee3Child id: 3 super: 1 source: b.jar ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/24223#discussion_r2042386067