Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-6177

[classlib][beans] java.beans.PropertyDescriptor(String propertyName, Class<?> beanClass, String getterName, String setterName) sets the wrong write method

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 5.0M9
    • 5.0M10
    • Classlib
    • None
    • Moderate

    Description

      Given a test case [1], RI passes it while HY fails.
      The MockJSplitPane class extends javax.swing.JSplitPane and overwrite its setDividerLocation(int) method.
      The test case creates a java.beans.PropertyDescriptor object using "dividerLocation" propertyName, null read method, and "setDividerLocation" write method.
      Then, RI returns the correct method:
      "public void PropertyDescriptorTest$MockJSplitPane.setDividerLocation(int)"

      but HY returns a homony method but from its super class:
      "public void javax.swing.JSplitPane.setDividerLocation(double)"

      [1] Test Case:
      class MockJSplitPane extends javax.swing.JSplitPane {
      private static final long serialVersionUID = 3109235561744543400L;
      public void setDividerLocation(int dividerLocation)

      { super.setDividerLocation(dividerLocation); }

      }
      public void test_setWriteMethod_MockJSplitPane() throws Exception {
      Class<?> beanClass = MockJSplitPane.class;
      String propertyName = "dividerLocation";
      String setterName = "setDividerLocation";
      PropertyDescriptor pd = new PropertyDescriptor(propertyName, beanClass, null, setterName);
      assertEquals(propertyName, pd.getName());
      assertNull(pd.getReadMethod());

      Method expectedMethod = beanClass.getMethod(setterName, new Class[]

      { int.class }

      );
      assertEquals(expectedMethod, pd.getWriteMethod());
      }

      Attachments

        1. HARMONY-6177.diff
          7 kB
          Kevin Zhou

        Activity

          People

            tellison Tim Ellison
            zhoukevin Kevin Zhou
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 48h
                48h
                Remaining:
                Remaining Estimate - 48h
                48h
                Logged:
                Time Spent - Not Specified
                Not Specified