On Tue, 11 Jul 2023 17:38:42 GMT, Mandy Chung <[email protected]> wrote:
>> Chen Liang has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> Fix the lazy test, thanks Jorn Vernee!
>
> test/jdk/java/lang/invoke/MethodHandleProxies/ProxiesImplementationTest.java
> line 206:
>
>> 204:
>> 205: System.gc();
>> 206: assertTrue(cl.refersTo(null), "MHP impl class should be cleared
>> by gc"); // broken
>
> Use `jdk.test.lib.util.ForceGC` to make the check more reliable. Add
> `@library /test/lib` to use the test library.
>
> Suggestion:
>
> if (ForceGC.wait(() -> wr.refersTo(null))) {
> assertTrue(wr.refersTo(null), "MHP impl class should be cleared
> by gc");
> }
Can test new hidden class is spinned after `ForceGC`:
c1 = asInterfaceInstance(ifaceClass, mh);
c2 = asInterfaceInstance(ifaceClass, mh);
assertTrue(c1.getClass() == c2.getClass(), "MHP should reuse
implementation class when available");
Reference.reachabilityFence(c1);
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13197#discussion_r1260071394