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

Unstable behavior of PropertyDescriptor's getWriteMethod() in case of overloaded setters

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • 9
    • client-libs
    • b124

      JDK9 b115 + Win. 7

      To reproduce please run test/java/beans/Performance/Test4058433.java several times:

      $ $JDK/bin/java Test4058433 | tee log1.txt
      ...
      $ $JDK/bin/java Test4058433 | tee log5.txt

      then try to compare logs:

      $ diff log1.txt log2.txt
      82219,82220c82219,82220
      < property type: java.util.Vector
      < write method: public void javax.swing.JList.setListData(java.util.Vector)
      ---
      > property type: [Ljava.lang.Object;
      > write method: public void javax.swing.JList.setListData(java.lang.Object[])

      ...

      $ diff log1.txt log5.txt
      198923,198924c198923,198924
      < property type: java.util.Vector
      < write method: public void javax.swing.table.DefaultTableModel.setColumnIdentifiers(java.util.Vector)
      ---
      > property type: [Ljava.lang.Object;
      > write method: public void javax.swing.table.DefaultTableModel.setColumnIdentifiers(java.lang.Object[])

      etc.

      So it seems that the getWriteMethod() (ln 145 of the test) chooses the setter randomly. Only one setter per log is chosen as a "write method":
      $ cat log1.txt | grep "write method: public void javax.swing.JList.setListData"
      write method: public void javax.swing.JList.setListData(java.util.Vector)

            serb Sergey Bylokhov
            avstepan Alexander Stepanov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: