On Wed, 20 Dec 2023 15:01:02 GMT, Raffaello Giulietti <rgiulie...@openjdk.org> 
wrote:

>> src/java.base/share/classes/java/io/SerializationMisdeclarationChecker.java 
>> line 113:
>> 
>>> 111:             if (longFromStatic(f) == null) {
>>> 112:                 commitEvent(SUID_CONVERTIBLE_TO_LONG,
>>> 113:                         SUID_NAME + " must be convertible to long via 
>>> widening to be effective");
>> 
>> The serialization spec only shows using long.  If any recommendation is made 
>> it should be to declare the field as a `long`
>
> There's a check on the type at L.104 which is about the "should" 
> recommendation, since serialization does not care about the type of the field 
> being `long`.
> 
> This check is about the value at runtime, which is a "must" because 
> serialization expects it to be convertible to long by widening.

The implementation should not show through. I don't remember if the particular 
implementation was intentional or just a shortcut to get the value. But any 
suggestion that implies a fix should be to recommend the best practice.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17129#discussion_r1432834402

Reply via email to