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

getting different results with JDK 1.8.0_31 and JDK 1.8.0_74

XMLWordPrintable

    • generic
    • generic

      FULL PRODUCT VERSION :
      Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
      Java(TM) SE Runtime Environment (build 1.8.0_74-b02)


      ADDITIONAL OS VERSION INFORMATION :
      SunOS d05prapp01 5.10 Generic_150400-29 sun4v sparc SUNW,SPARC-Enterprise-T5220

      A DESCRIPTION OF THE PROBLEM :
      I get different results when the java code below is executed.

      Java(TM) SE Runtime Environment (build 1.8.0_31-b13) returns:
      class: java.beans.PropertyDescriptor
      paymentComponentList: java.beans.IndexedPropertyDescriptor

      Java(TM) SE Runtime Environment (build 1.8.0_74-b02) returns:
       class: java.beans.PropertyDescriptor
      paymentComponentList: java.beans.PropertyDescriptor

      Here is the java code:
      import java.beans.BeanInfo;
      import java.beans.IntrospectionException;
      import java.beans.Introspector;
      import java.beans.PropertyDescriptor;
      import java.util.ArrayList;

      public class DescriptorTest {
              private ArrayList<Integer> paymentComponentList = new ArrayList<Integer>();

              public Integer getPaymentComponentList(int index) {
                      final int size = paymentComponentList.size();
                      if (size > index) {
                              return paymentComponentList.get(index);
                      } else {
                              return null;
                      }
              }

              public void setPaymentComponentList(ArrayList<Integer> paymentComponentList) {
                      this.paymentComponentList = paymentComponentList;
              }

              public static void main(String[] args) {
                      BeanInfo beanInfo = null;
                      PropertyDescriptor descriptors[] = null;
                      try {
                              beanInfo = Introspector.getBeanInfo(DescriptorTest.class);
                      } catch (IntrospectionException e) {
                              System.err.println(e.toString());
                      }
                      descriptors = beanInfo.getPropertyDescriptors();
                      for (PropertyDescriptor d : descriptors) {
                              System.out.println(d.getDisplayName() + ": "
                                              + d.getClass().getCanonicalName());
                      }
              }

      }




      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      see description

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      consistency between versions

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.beans.BeanInfo;
      import java.beans.IntrospectionException;
      import java.beans.Introspector;
      import java.beans.PropertyDescriptor;
      import java.util.ArrayList;

      public class DescriptorTest {
              private ArrayList<Integer> paymentComponentList = new ArrayList<Integer>();

              public Integer getPaymentComponentList(int index) {
                      final int size = paymentComponentList.size();
                      if (size > index) {
                              return paymentComponentList.get(index);
                      } else {
                              return null;
                      }
              }

              public void setPaymentComponentList(ArrayList<Integer> paymentComponentList) {
                      this.paymentComponentList = paymentComponentList;
              }

              public static void main(String[] args) {
                      BeanInfo beanInfo = null;
                      PropertyDescriptor descriptors[] = null;
                      try {
                              beanInfo = Introspector.getBeanInfo(DescriptorTest.class);
                      } catch (IntrospectionException e) {
                              System.err.println(e.toString());
                      }
                      descriptors = beanInfo.getPropertyDescriptors();
                      for (PropertyDescriptor d : descriptors) {
                              System.out.println(d.getDisplayName() + ": "
                                              + d.getClass().getCanonicalName());
                      }
              }

      }

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

      SUPPORT :
      YES

            serb Sergey Bylokhov
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: