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

Calvin Cheung ccheung at openjdk.org
Fri Apr 21 22:14:57 UTC 2023


On Thu, 20 Apr 2023 23:20:38 GMT, Ioi Lam <iklam 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

Thanks @iklam for the review.

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

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


More information about the hotspot-runtime-dev mailing list