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

BeanInfo from Introspector.getBeanInfo() undefined for multiple setters/getters

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P3
    • None
    • 1.2.2, 1.3.0, 1.4.0
    • client-libs
    • generic, x86, sparc
    • generic, solaris_8, windows_95

    Description



      Name: rlT66838 Date: 10/04/99


      May be related to bug #4144543.

      Reproducing the problem:

      Create a class (call it "BITest") that extends java.awt.Component and overrides "public void setSize(Dimension size)".

      Now call Introspector.getBeanInfo(BITest.class).getPropertyDestriptors(), and find the PropertyDescriptor for the "size" property.
      This PropertyDescriptor returns "null" for "getReadMethod()", when it should return the "Component.getSize" method.

      I imagine this is somehow caused by the multiple "setSize" methods defined by Component..?

      <---- EXAMPLE SOURCE ---->

      /*********************
       * File: BITest.java *
       *********************/
      public class BITest extends java.awt.Component {
          public void setSize(java.awt.Dimension size) {
              super.setSize( size );
          }
      }

      /*********************
       * File: Main.java *
       *********************/
      import java.beans.*;

      public class Main {
          public static void main(String[] args) {
              try {
                  BeanInfo bi = Introspector.getBeanInfo(BITest.class);
                  PropertyDescriptor[] pds = bi.getPropertyDescriptors();
                  PropertyDescriptor sizePD = null;
                  for(int i = 0; i < pds.length; i++) {
                      if (pds[i].getName().equals("size")) {
                          sizePD = pds[i];
                          break;
                      }
                  }

                  System.out.println("size ReadMethod: " + sizePD.getReadMethod());
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }
      }
      (Review ID: 36341)
      ======================================================================

      Attachments

        Issue Links

          Activity

            People

              mdavidsosunw Mark Davidson (Inactive)
              rlewis Roger Lewis (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: