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

"preferred" flag of java.beans.FeatureDescriptor not preserved

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 1.3.0
    • client-libs
    • beta
    • generic
    • generic



      Name: krC82822 Date: 02/08/2001


      8 Feb 2001, eval1127@eng -- needs to be set (preserved)
      in both package-private constructors (see Comments section)
      ----------------
      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Server VM (build 2.0fcs-E, mixed mode)

      and

      java version "1.4.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b50)
      Java HotSpot(TM) Client VM (build 1.4beta-B50, mixed mode)

      ----------------

      In the getPropertyDescriptors() method of my MyClassBeanInfo class, I set the
      preferred flag for a given property.

      After I retrieve the property from the BeanInfo returned from the
      java.beans.Introspector.getBeanInfo( "MyClass" ); the preferred flag is not set.

      In looking through the source code it is due to the package-private constructor
      of FeatureDescriptor not copying the state of the preferred flag, e.g. from
      java.beans.FeatureDescriptor.java line: 225 - 237

          /*
           * Package-private dup constructor
           * This must isolate the new object from any changes to the old object.
           */
          FeatureDescriptor(FeatureDescriptor old) {
      expert = old.expert;
      hidden = old.hidden;
      name = old.name;
      shortDescription = old.shortDescription;
      displayName = old.displayName;
      addTable(old.table);
      // preferred = old.preferred; // <<<--- NEEDED
          }

      This constructor should also have the following line:

      preferred = old.preferred;
      (Review ID: 109886)
      ======================================================================

            mdavidsosunw Mark Davidson (Inactive)
            kryansunw Kevin Ryan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: