RFR: 8275338: Add JFR events for notable serialization situations [v4]
Daniel Fuchs
dfuchs at openjdk.org
Wed Dec 20 08:34:49 UTC 2023
On Tue, 19 Dec 2023 16:00:09 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:
>> src/java.base/share/classes/jdk/internal/event/SerializationMisdeclarationEvent.java line 94:
>>
>>> 92:
>>> 93: /*
>>> 94: * These constants are not final on purpose.
>>
>> Just curious - what's the purpose? I don't see them being changed/updated anywhere (not even in tests).
>
> Declaring a `public static int` field `final` means that the value is then stored in the client class. If a value is changed, then the client needs to be recompiled as well, but this is not enforced by the language, so it might lead to inconsistencies.
>
> The clean solution would be to use an enum class, but that's not supported by JFR.
Not having them final is a quite smelly. I would suggest to make them final with a comment that new values can be added but that existing values must not be changed.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17129#discussion_r1432400888
More information about the core-libs-dev
mailing list