On Fri, 2 Jan 2026 10:05:57 GMT, Prasanta Sadhukhan <[email protected]>
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..
>
> Prasanta Sadhukhan has updated the pull request incrementally with one
> additional commit since the last revision:
>
> Component count leakage fix
src/java.desktop/share/classes/javax/swing/JTable.java line 5610:
> 5608: }
> 5609:
> 5610: public void writeExternal(java.io.ObjectOutput out) throws
> IOException {}
Can add @Override here ?
src/java.desktop/share/classes/javax/swing/JTable.java line 5612:
> 5610: public void writeExternal(java.io.ObjectOutput out) throws
> IOException {}
> 5611:
> 5612: public void readExternal(java.io.ObjectInput in) throws
> IOException {}
I suggest adding `java.io.ObjectInput/ObjectOutput` imports would be better
rather than expanding here.
test/jdk/javax/swing/JTable/EditingJTableNotSerializable.java line 64:
> 62: private static void testSerializeEditingTable(StringBuilder str) {
> 63: try {
> 64: Object[][] data = new Object[][]{ new Object[]{ 1,2,3,4,5}};
Suggestion:
Object[][] data = new Object[][]{ new Object[]{1, 2, 3, 4, 5}};
test/jdk/javax/swing/JTable/EditingJTableNotSerializable.java line 65:
> 63: try {
> 64: Object[][] data = new Object[][]{ new Object[]{ 1,2,3,4,5}};
> 65: Object[] names = new Object[]{ 1,2,3,4,5};
Suggestion:
Object[] names = new Object[]{1, 2, 3, 4, 5};
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28627#discussion_r2685033972
PR Review Comment: https://git.openjdk.org/jdk/pull/28627#discussion_r2685038227
PR Review Comment: https://git.openjdk.org/jdk/pull/28627#discussion_r2685216548
PR Review Comment: https://git.openjdk.org/jdk/pull/28627#discussion_r2685217523