On Thu, 2 Jul 2026 10:55:25 GMT, Alan Bateman <[email protected]> wrote:

>> Make sure object-writing serialization fails for "strict in serializable 
>> super". We currently already fail when they are deserialized.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> src/java.base/share/classes/java/io/ObjectStreamClass.java line 399:
> 
>> 397:                     if (deserializer == null) {
>> 398:                         serializeEx = deserializeEx = new 
>> ExceptionInfo(cl.getName(),
>> 399:                                 "cannot serialize due to concrete value 
>> class or strict instance fields");
> 
> Having "concrete" in the exception message might be confusing, I think it 
> would be okay to reduce it to "value class" here.

Maybe non‑`abstract`?

Since `Serializable` fieldless `abstract` value classes like 
`java.lang​.Number` are ok.

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

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2612#discussion_r3512664614

Reply via email to