RFR: 6441373: Editing JTable is not Serializable
Prasanta Sadhukhan
psadhukhan at openjdk.org
Thu Dec 4 01:56:59 UTC 2025
On Wed, 3 Dec 2025 21:53:06 GMT, Alexander Zuev <kizune at openjdk.org> wrote:
>> Issue is when JTable is in editing mode, it is not Serializable as it gives exception
>>
>> java.io.NotSerializableException: java.lang.reflect.Constructor
>> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1149) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1502)
>> at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1467)
>> at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1385)
>> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1143) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1502)
>> .......
>>
>>
>> It is caused by creation of `GenericEditor` class which uses a non-serializable Constructor field.
>> This is fixed by making the field transient..
>> Also, `editorRemover` field is made transient as it is object of `CellEditorRemover` class which is not Serializable..
>
> test/jdk/javax/swing/JTable/EditingJTableNotSerializable.java line 65:
>
>> 63: tce.stopCellEditing();
>> 64: System.out.println("Serializing non-editing JTable");
>> 65: serialize(jt);
>
> Can you please add the code that tries to deserialize the new object from the serialized form? Just to be sure that there is nothing that will be broken in the process of serialization.
The test does that too deserialize after serialize in `serialize` method...actually the method is a misnomer but I kept it as it is from reproducer..
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28627#discussion_r2587154103
More information about the client-libs-dev
mailing list