On Wed, 16 Apr 2025 14:34:25 GMT, Timofei Pushkin <tpush...@openjdk.org> wrote:
>> If a base class is package-private then its subclasses should have the same >> package name and defining class loader, otherwise `IllegalAccessError` is >> thrown when linking a subclass. Currently when dumping a static archive >> separate `URLClassLoader`s are used for each unregistered classes' source. >> Thus if two unregistered classes, a package-private base class and a sub >> class, from the same package reside in different sources >> `IllegalAccessError` will be thrown when linking the sub class. This can be >> unexpected because the app could have used a single class loader for both >> classes and thus not have seen the error — see `DifferentSourcesApp.java` >> from this patch for an example of such app. >> >> This patch fixes the issue by using a single class loader for all >> unregistered classes. CDS does not allow classes with the same name making >> such solution possible. > > Timofei Pushkin has updated the pull request with a new target base due to a > merge or a rebase. The pull request now contains 15 commits: > > - Empty commit to make GH update the PR > - Merge remote-tracking branch 'openjdk-jdk/master' into one-loader > - Implement super overshadowing warning > - Omit Source classes from archive > - Remove unused imports > - Fix indentation > - Extend ClassFromClasspath test > - Remove findClass, extend explanation comments > - Remove unnecessary scoping > - Don't use URLClassPath > - ... and 5 more: https://git.openjdk.org/jdk/compare/465c8e65...595756f3 Found an issue on the RegUnregSuperTest.java. test/hotspot/jtreg/runtime/cds/appcds/customLoader/RegUnregSuperTest.java line 77: > 75: out.shouldContain("CustomLoadee3Child (id 3) has super-type > CustomLoadee3 (id 1) overshadowed by another class with the same name"); > 76: } else { > 77: out.shouldContain("unreg CustomLoadee3Child\n"); Could you remove the linefeed ('\n') chars? I'm seeing test failure when running with the `-XX:+AOTClassLinking` option. java.lang.RuntimeException: 'app CustomLoadee3 ' missing from stdout/stderr at jdk.test.lib.process.OutputAnalyzer.shouldContain(OutputAnalyzer.java:253) at RegUnregSuperTest.main(RegUnregSuperTest.java:71) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) at java.base/java.lang.reflect.Method.invoke(Method.java:565) at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:335) at java.base/java.lang.Thread.run(Thread.java:1447) The expected output is there: `[1.686s][debug ][cds,class] klasses[ 1548] = 0x00000008004c7518 app CustomLoadee3 aot-linked` ------------- Changes requested by ccheung (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/24223#pullrequestreview-2774638133 PR Review Comment: https://git.openjdk.org/jdk/pull/24223#discussion_r2048272791