RFR: 8278065: Refactor subclassAudits to use ClassValue [v3]

Peter Levart plevart at openjdk.java.net
Wed Jan 12 06:49:32 UTC 2022


On Fri, 10 Dec 2021 21:07:37 GMT, Roman Kennke <rkennke at openjdk.org> wrote:

>> As a follow-up to #6375, this change refactors java.io.ObjectInputStream.Caches#subclassAudits and java.io.ObjectOutputStream.Caches#subclassAudits to use ClassValue instead of SoftReference, similar to what we did in #6375 for java.io.ObjectStreamClass.Caches#localDescs. Then we can now also remove the common machinery java.io.ObjectStreamClass#processQueue and java.io.ObjectStreamClass.WeakClassKey.
>> 
>> Testing:
>>  - [x] tier1
>>  - [x] tier2
>>  - [ ] tier3
>
> Roman Kennke has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains ten commits:
> 
>  - Merge branch 'master' into JDK-8278065
>  - 8278065: Refactor subclassAudits to use ClassValue
>  - Remove unused EntryFuture inner class from ObjectSteamClass
>  - Merge remote-tracking branch 'jdk-plevart/JDK-8277072-peter' into JDK-8277072
>  - Use ClassValue to solve JDK-8277072
>  - Use ForceGC instead of System.gc()
>  - Convert test to testng
>  - Fix indentation of new testcase
>  - 8277072: ObjectStreamClass caches keep ClassLoaders alive

Marked as reviewed by plevart (Reviewer).

I think this looks good. Reviewed. Only a minor nit if you think it would be better, but not necessary if you don't. The following combo:


        Boolean result = Caches.subclassAudits.get(cl);
        assert result != null;


could be written as:


        boolean result = Caches.subclassAudits.get(cl);


...and it would give the same "message" to the reader. WDYT? No need for another round of reviews if you change this.

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

PR: https://git.openjdk.java.net/jdk/pull/6637


More information about the core-libs-dev mailing list