JDK-8094602 : [TreeItem] Incompatible API change to TreeItem$TreeModificationEvent constructor
  • Type: Bug
  • Component: javafx
  • Sub-Component: controls
  • Affected Version: 8u40
  • Priority: P1
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2014-12-12
  • Updated: 2020-06-11
  • Resolved: 2014-12-12
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8u40Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
The fix for RT-38787 inadvertently removed a constructor with the following part of the change:

         public TreeModificationEvent(EventType<? extends Event> eventType,
-                TreeItem<T> treeItem, List<? extends TreeItem<T>> added,
-                List<? extends TreeItem<T>> removed) {
+                                     TreeItem<T> treeItem,
+                                     List<? extends TreeItem<T>> added,
+                                     List<? extends TreeItem<T>> removed,
+                                     ListChangeListener.Change<? extends TreeItem<T>> change) {

This is an incompatible API change.
Comments
hmmm ...only marginally related, but anyway: the event should expose the list change, otherwise it's rather useless to have in any constructor, IMO. See RT-39644
12-12-2014

Changeset: http://hg.openjdk.java.net/openjfx/8u-dev/rt/rev/da38d706a6f8
12-12-2014

Looks good. +1
12-12-2014

Proposed patch (note that the new constructor is private as it is not actually required outside of TreeItem, so there is no new API): diff --git a/modules/controls/src/main/java/javafx/scene/control/TreeItem.java b/modules/controls/src/main/java/javafx/scene/control/TreeItem.java --- a/modules/controls/src/main/java/javafx/scene/control/TreeItem.java +++ b/modules/controls/src/main/java/javafx/scene/control/TreeItem.java @@ -1046,6 +1046,26 @@ public TreeModificationEvent(EventType<? extends Event> eventType, TreeItem<T> treeItem, List<? extends TreeItem<T>> added, + List<? extends TreeItem<T>> removed) { + this(eventType, treeItem, added, removed, null); + } + + /** + * Constructs a TreeModificationEvent for when the TreeItem has had its + * children list changed, including the + * {@link javafx.collections.ListChangeListener.Change} that has taken place. + * + * @param eventType The type of the event that has occurred. + * @param treeItem The TreeItem on which this event occurred. + * @param added A list of the items added to the children list of the + * given TreeItem. + * @param removed A list of the items removed from the children list of + * the given TreeItem. + * @param change The actual change that has taken place on the children list. + */ + private TreeModificationEvent(EventType<? extends Event> eventType, + TreeItem<T> treeItem, + List<? extends TreeItem<T>> added, List<? extends TreeItem<T>> removed, ListChangeListener.Change<? extends TreeItem<T>> change) { super(eventType);
12-12-2014

The remedy will be to add back in the previous constructor. The new constructor will need an @since JavaFX 8u40 and an @param tag for the new argument.
12-12-2014