RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive [v4]
Peter Levart
plevart at openjdk.java.net
Sat Dec 4 08:53:13 UTC 2021
On Thu, 2 Dec 2021 14:24:06 GMT, Roman Kennke <rkennke at openjdk.org> wrote:
>> src/java.base/share/classes/java/io/ObjectStreamClass.java line 2133:
>>
>>> 2131: if (oldReflector != null) {
>>> 2132: reflector = oldReflector;
>>> 2133: }
>>
>> Map.computeIfAbsent(key, () -> new FieldReflector(matchFields, localDesc));
>> might be more compact.
>
> That would be nicer, indeed. Problem is that matchFields throws an InvalidClassException, and that would have to get passed through the lambda.
> Also, that problem is pre-existing and not related to the change.
Yes, I did computeIfAbsent() originally just to find out handling check exception/wrapping/unwrapping would make the code much more complex.
-------------
PR: https://git.openjdk.java.net/jdk/pull/6375
More information about the core-libs-dev
mailing list