RFR: 8287596: Reorg jdk.test.lib.util.ForceGC [v9]

Xue-Lei Andrew Fan xuelei at openjdk.org
Sat Jun 18 06:03:54 UTC 2022


On Thu, 16 Jun 2022 16:08:04 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> Xue-Lei Andrew Fan has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   remove trailing whitespaces
>
> test/jdk/java/io/ObjectStreamClass/TestOSCClassLoaderLeak.java line 64:
> 
>> 62:         assertNotNull(myOwnClassLoaderWeakReference.get());
>> 63: 
>> 64:         assertTrue(ForceGC.wait(() -> myOwnClassLoaderWeakReference.get() == null));
> 
> The call to ref.get() can create a strong reference to the object; depending on the timing it might interfere with the GC in process.
> `ref.refersTo(null)` is preferred over `ref.get() == null` 
> 
> Here and all subsequent changes.

Good point.  I learned a lot these days from PRs comments!  Thank you!

The patch is changed to use refersTo().

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

PR: https://git.openjdk.org/jdk/pull/8979


More information about the core-libs-dev mailing list