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

PropertyDescriptor.getReadMethod return "get" prefix insted of "is" prefix.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 6u21
    • client-libs

      FULL PRODUCT VERSION :
      java version "1.6.0_20"
      Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
      Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Windows 7 64-bit

      A DESCRIPTION OF THE PROBLEM :
      getReadMethod method from PropertyDescriptor class from java.beans package returns "get" prefix insted of "is" prefix.

      for example if field is declared as "Boolean field" getReadMethod returns "getField", when it should return "isField".

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      package pl.dolorfer;

      import java.beans.BeanInfo;
      import java.beans.IntrospectionException;
      import java.beans.Introspector;
      import java.beans.PropertyDescriptor;

      public class Test
      {
        private Boolean b;
        public Boolean isB(){return b;}
        public void setB(Boolean b){this.b = b;}

        public static void main(String[] args) throws IntrospectionException
        {
          BeanInfo info = Introspector.getBeanInfo( Test.class );
          PropertyDescriptor[] props = info.getPropertyDescriptors();
          System.out.println(props[0].getReadMethod());
        }
      }



      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package pl.dolorfer;

      import java.beans.BeanInfo;
      import java.beans.IntrospectionException;
      import java.beans.Introspector;
      import java.beans.PropertyDescriptor;

      public class Test
      {
        private Boolean b;
        public Boolean isB(){return b;}
        public void setB(Boolean b){this.b = b;}

        public static void main(String[] args) throws IntrospectionException
        {
          BeanInfo info = Introspector.getBeanInfo( Test.class );
          PropertyDescriptor[] props = info.getPropertyDescriptors();
          System.out.println(props[0].getReadMethod());
        }
      }

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

            malenkov Sergey Malenkov (Inactive)
            malenkov Sergey Malenkov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: