RFR: 8304696: Duplicate class names in dynamicArchive tests can lead to test failure

Ioi Lam iklam at openjdk.org
Thu Apr 20 23:23:41 UTC 2023


On Wed, 19 Apr 2023 17:07:14 GMT, Calvin Cheung <ccheung at openjdk.org> wrote:

> To avoid duplicate class name `MyShutdown`, the fix is to change the `MyShutdown` class name for the LambdaProxyDuringShutdown.java test to `ShutdownHelper`.
> 
> Tested manually by running the LInkClassTest.java and LambdaProxyDuringShutdown.java tests serially on linux-x64.
> Also ran tiers 1 and 3 testing.

I think it's better to restructure the test classes to avoid having the same problem in the future -- classes with generic names that appear in multiple, unrelated test cases.

In this particular case, we have both LinkClassApp.java and LambdaProxyDuringShutdownApp.java that contain two different implementation of a class with the same name, MyShutdown.

I would suggest putting the small, generic classes as static inner classes. E.g.,


public class LinkClassApp.java {
    static class MyShutdown { ... }
    static class Outer { ...}
}


Then, the test cases can refer to this class using a unique name, like


@run driver jdk.test.lib.helpers.ClassFileInstaller -jar lambda_proxy_shutdown.jar ....
             LambdaProxyDuringShutdownApp$MyShutdown ....


LinkClassApp.java (and perhaps some more test classes) should also be restructured similarly.

Thanks

-------------

PR Comment: https://git.openjdk.org/jdk/pull/13542#issuecomment-1517052230


More information about the hotspot-runtime-dev mailing list