JDK-8313635 : There are deficiencies in the getItems method of the ComboBox component
  • Type: Enhancement
  • Component: javafx
  • Sub-Component: controls
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: generic
  • CPU: generic
  • Submitted: 2023-07-22
  • Updated: 2023-08-14
  • Resolved: 2023-08-02
Related Reports
Relates :  
Description
A DESCRIPTION OF THE PROBLEM :
`getItems() `not use `itemsProperty()` to obtain the corresponding items property, but instead directly called the `items` variable

https://github.com/openjdk/jfx/blob/600cee70a2f6f907a53f7183315e6d7f79b291d6/modules/javafx.controls/src/main/java/javafx/scene/control/ComboBox.java#L313



Comments
Per earlier conversation, getItems() is fine as is, but the property and its accessors should be made final, see JDK-8313651. Closing this ticket as won't fix.
02-08-2023

thank you, [~kcr]. Filed JDK-8313651 Add 'final' keyword to properties and accessors in controls.
02-08-2023

[~angorya] It's up to dev to decide whether to close a bug as "Won't fix" or "Not an issue" (if we don't want to accept it into the backlog). Similarly, if while evaluating this bug we discover a new bug, we should file that new bug ourselves. So in this case, I think closing as won't fix and filing a new bug that references this bug seems best.
02-08-2023

[~pnarayanaswa] would you like to close this ticket as won't fix and create a new one to add the 'final' keyword to all the properties and their accessors in javafx.controls? (Or perhaps we could repurpose this ticket?)
02-08-2023

> What is the harm here? itemsProperty() returns 'items', so functionally this is an equivalent if we ignore the issue discussed below. Yes, setting aside the below issue, they are functionally equivalent. Many JavaFX classes access the property field directly, when there isn't a need to do otherwise. > The bigger issue is that itemsProperty() method is not final (line 314), and neither is the property declaration itself (line 311). Same issue can be seen on lines 324, 325, 341, and so on. Yes, that is a clear oversight that should be fixed. > We probably should consider fixing all the occurrences where properties and their accessor methods are not final, and that would require a CSR. Agreed.
02-08-2023

What is the harm here? itemsProperty() returns 'items', so functionally this is an equivalent if we ignore the issue discussed below. The bigger issue is that itemsProperty() method is not final (line 314), and neither is the property declaration itself (line 311). Same issue can be seen on lines 324, 325, 341, and so on. We probably should consider fixing all the occurrences where properties and their accessor methods are not final, and that would require a CSR. [~kcr] what do you think?
02-08-2023

Moving to JDK Project for review.
02-08-2023