TreeTableCell: Misnamed / inconsistent methods for row and column properties

Kevin Rushforth kevin.rushforth at oracle.com
Mon Jul 12 17:22:26 UTC 2021


While evaluating a javadoc fix [1] that removes spurious warnings for 
missing comments on JavaFX property methods, I looked at the remaining 
warnings, and discovered an inconsistency in the naming of two of the 
properties in the TreeTableCell class. I filed JDK-8270314 [2] to track 
this.

Before I submit a PR, I wanted to solicit comments.

In TreeTableCell, there is a mismatch between name of the following 
property method vs the getter:

   tableRowProperty()
   getTreeTableRow()

the get method has "Tree" in the name while the property method does not.

The corresponding methods for column are self-consistent, and are named 
without the "tree" in the name:

       tableColumnProperty()
       getTableColumn()

Given the type of the property -- TreeTableRow and TreeTableColumn, 
respectively -- the properties should have "Tree" in the name, but 
don't. Somewhat related is that the update methods for both row and 
column are updateTreeTableColumn​ and updateTreeTableRow​ which do have 
"TreeTable" in the name:

There are two possible solutions that seem workable:

Possible solutions:

1. Add Tree to all methods of the row and column properties

   tableRowProperty() --> treeTableRowProperty()

   tableColumnProperty() --> treeTableColumnProperty()
   getTableColumn() --> getTreeTableColumn()

This is the most consistent, but is slightly more intrusive in that 
changes 3 of the 4 public methods of the row and column properties.


2. Remove Tree from all methods of these properties

   getTreeTableRow() -> getTableRow()

This is a less intrusive change that only affects one method. While it 
makes the properties self-consistent and consistent with each other, the 
names are not what would be expected given the return type 
(TreeTableColumn and TreeTableRow), and are not consistent with the 
update methods. Also, for applications that don't use the property 
method, and only use the getter, it isn't any less change than the the 
first option.


I propose to go with option #1 for maximum consistency and further 
propose to deprecate *not for removal* the misnamed methods.


Comments?

-- Kevin

[1] https://github.com/openjdk/jdk/pull/4747
[2] https://bugs.openjdk.java.net/browse/JDK-8270314



More information about the openjfx-dev mailing list