RFR: 6441373: Editing JTable is not Serializable [v2]
Prasanta Sadhukhan
psadhukhan at openjdk.org
Mon Feb 2 13:25:18 UTC 2026
On Thu, 29 Jan 2026 00:33:11 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:
>> The patch implements serialization for editable JTables. Currently, most classes responsible for JTable editing are not serializable, so trying to serialize them causes an exception. The patch has two parts:
>>
>> - The editable JTable is reset to non-editable using the common pattern stopCellEditing + cancelCellEditing. This is added to the compWriteObjectNotify method, which acts as an entry point for serialization of Swing components. It allows actions to be performed before the parent classes are serialized.
>>
>> - The editing coordinates for all JTables are reset to -1. Before this patch, even non-editable JTables had their coordinates reset to 0 from -1 because the fields were transient.
>
> Sergey Bylokhov has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
>
> - Merge branch 'openjdk:master' into JDK-6441373
> - Update JTableSerialization.java
> - 6441373: Editing JTable is not Serializable
Marked as reviewed by psadhukhan (Reviewer).
src/java.desktop/share/classes/javax/swing/JTable.java line 6011:
> 6009: editorRemover = (PropertyChangeListener) f.get("editorRemover", null);
> 6010: editingColumn = -1;
> 6011: editingRow = -1;
Thanks for this ingenious solution
-------------
PR Review: https://git.openjdk.org/jdk/pull/29313#pullrequestreview-3739371304
PR Review Comment: https://git.openjdk.org/jdk/pull/29313#discussion_r2754312620
More information about the client-libs-dev
mailing list