Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8164096

ListChangeListener on ReadOnlyListWrapper's getReadOnlyProperty() does not reset change

    Details

    • Subcomponent:
    • Introduced In Version:
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        FULL PRODUCT VERSION :
        java version "1.8.0_92"
        Java(TM) SE Runtime Environment (build 1.8.0_92-b14)
        Java HotSpot(TM) 64-Bit Server VM (build 25.92-b14, mixed mode)

        ADDITIONAL OS VERSION INFORMATION :
        Linux host.mydomain.com 4.6.5-200.fc23.x86_64 #1 SMP Thu Jul 28 01:10:25 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux


        A DESCRIPTION OF THE PROBLEM :
        see attached source to reproduce

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        execute the attached code


        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        console output:

        changelistener 1
        handle change
        changelistener 2
        handle change
        changelistener 1
        handle change
        changelistener 2
        handle change

        ACTUAL -
        console output:

        changelistener 1
        handle change
        changelistener 2
        changelistener 1
        handle change
        changelistener 2

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        import javafx.beans.property.ReadOnlyListWrapper;
        import javafx.collections.FXCollections;
        import javafx.collections.ListChangeListener;

        public class TestListchangelistener2 {
        private final ReadOnlyListWrapper<String> list = new ReadOnlyListWrapper<>(FXCollections.observableArrayList());

        public TestListchangelistener2() {
        list.addListener((ListChangeListener<String>) c -> {
        System.err.println("changelistener 1");
        while (c.next()) {
        System.err.println("handle change");
        }
        });
        list.getReadOnlyProperty().addListener((ListChangeListener<String>) c -> {
        System.err.println("changelistener 2");
        //c.reset(); // workaround
        while (c.next()) {
        System.err.println("handle change");
        }
        });
        list.add("bla");
        list.addAll("bli");
        }

        public static void main(String[] args) {
        new TestListchangelistener2();
        }
        }

        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        call change.reset()
        (see commented line in test case)

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  vadim Vadim Pakhnushev
                  Reporter:
                  webbuggrp Webbug Group
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  6 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: