title: Java JDK 8 IndexedPropertyDescriptor has changed since JDK 7 with List object
body: <p>I have a simple issue. I have a program working in Java JDK7 but it doesn't work in JDK8 because of some introspection changes.</p>
  
  <p>Here is a test program to reproduce the issue:</p>
  
  <pre><code>import java.beans.BeanInfo;
  import java.beans.IntrospectionException;
  import java.beans.Introspector;
  import java.beans.PropertyDescriptor;
  import java.util.ArrayList;
  import java.util.List;
  
  public class Main {
  
      public static void main(String[] args) throws IntrospectionException {
          BeanInfo info = Introspector.getBeanInfo(MyListClass.class);
          PropertyDescriptor[] descriptors = info.getPropertyDescriptors();
          for (int i = 0; i &lt; descriptors.length; i++) {
              System.out.println(descriptors[i].getClass().getName() + ":" + descriptors[i].getName());
          }
  
          System.out.println("\n");
  
          BeanInfo info2 = Introspector.getBeanInfo(MyIndexedListClass.class);
          PropertyDescriptor[] descriptors2 = info2.getPropertyDescriptors();
          for (int i = 0; i &lt; descriptors2.length; i++) {
              System.out.println(descriptors2[i].getClass().getName() + ":" + descriptors2[i].getName());
          }
  
          System.out.println("\n");
  
          BeanInfo info3 = Introspector.getBeanInfo(MyArrayClass.class);
          PropertyDescriptor[] descriptors3 = info3.getPropertyDescriptors();
          for (int i = 0; i &lt; descriptors3.length; i++) {
              System.out.println(descriptors3[i].getClass().getName() + ":" + descriptors3[i].getName());
          }
  
          System.out.println("\n");
  
          BeanInfo info4 = Introspector.getBeanInfo(MyIndexedArrayClass.class);
          PropertyDescriptor[] descriptors4 = info4.getPropertyDescriptors();
          for (int i = 0; i &lt; descriptors4.length; i++) {
              System.out.println(descriptors4[i].getClass().getName() + ":" + descriptors4[i].getName());
          }
  
      }
  
      public class MyListClass {
          private List&lt;String&gt; myListClass = new ArrayList&lt;String&gt;();
  
          public List&lt;String&gt; getMyListClass() {
              return myListClass;
          }
  
          public void setMyListClass(List&lt;String&gt; myListClass) {
              this.myListClass = myListClass;
          }
  
      }
  
      public class MyIndexedListClass {
          private List&lt;String&gt; myIndexedListClass = new ArrayList&lt;String&gt;();
  
          public String getMyIndexedListClass(int index) {
              return myIndexedListClass.get(index);
          }
  
          public void setMyIndexedListClass(int index, String element) {
              this.myIndexedListClass.set(index, element);
          }
  
          public List&lt;String&gt; getMyIndexedListClass() {
              return myIndexedListClass;
          }
  
          public void setMyIndexedListClass(List&lt;String&gt; myIndexedListClass) {
              this.myIndexedListClass = myIndexedListClass;
          }
  
      }
  
      public class MyArrayClass {
          private String[] myArrayClass = new String[20];
  
          public String[] getMyArrayClass() {
              return myArrayClass;
          }
  
          public void setMyArrayClass(String[] myArrayClass) {
              this.myArrayClass = myArrayClass;
          }
  
      }
  
      public class MyIndexedArrayClass {
          private String[] myIndexedArrayClass = new String[20];
  
          public String getMyIndexedArrayClass(int index) {
              return myIndexedArrayClass[index];
          }
  
          public void setMyIndexedArrayClass(int index, String myValue) {
              this.myIndexedArrayClass[index] = myValue;
          }
  
          public String[] getMyIndexedArrayClass() {
              return myIndexedArrayClass;
          }
  
          public void setMyIndexedArrayClass(String[] myIndexedArrayClass) {
              this.myIndexedArrayClass = myIndexedArrayClass;
          }
  
      }
  }
  </code></pre>
  
  <p>Here are the JDK 7 logs:</p>
  
  <pre><code>java.beans.PropertyDescriptor:class
  java.beans.PropertyDescriptor:myListClass
  
  java.beans.PropertyDescriptor:class
  java.beans.IndexedPropertyDescriptor:myIndexedListClass
  
  java.beans.PropertyDescriptor:class
  java.beans.PropertyDescriptor:myArrayClass
  
  java.beans.PropertyDescriptor:class
  java.beans.IndexedPropertyDescriptor:myIndexedArrayClass
  </code></pre>
  
  <p>Here are the logs for JDK8:</p>
  
  <pre><code>java.beans.PropertyDescriptor:class
  java.beans.PropertyDescriptor:myListClass
  
  java.beans.PropertyDescriptor:class
  java.beans.PropertyDescriptor:myIndexedListClass -&gt; Here is the change
  
  java.beans.PropertyDescriptor:class
  java.beans.PropertyDescriptor:myArrayClass
  
  java.beans.PropertyDescriptor:class
  java.beans.IndexedPropertyDescriptor:myIndexedArrayClass
  </code></pre>
  
  <p>I have to use the JDK8 really soon but this is a blocking change because my app doesn't work anymore. I have this issue with all the classes that extend the <code>Collection</code> interface (List, Map, ...) </p>
  
  <p>The code is used by the library <code>commons-beanutils-1.8.0</code> from Apache Commons.</p>
  
  <p>I'm looking for a solution, a workaround, to make my application work the same way as before, when using the JDK7, is there any solution? I can't use Array instead of List (because Array hasn't changed)</p>
  
  <p>Here are the links to the official documentation:</p>
  
  <p>JDK7: <a href="http://docs.oracle.com/javase/7/docs/api/java/beans/IndexedPropertyDescriptor.html" rel="nofollow">http://docs.oracle.com/javase/7/docs/api/java/beans/IndexedPropertyDescriptor.html</a></p>
  
  <p>JDK8: <a href="http://docs.oracle.com/javase/8/docs/api/java/beans/IndexedPropertyDescriptor.html" rel="nofollow">http://docs.oracle.com/javase/8/docs/api/java/beans/IndexedPropertyDescriptor.html</a></p>
  
  <hr>
  
  <p>EDIT : I found my solution, my problem was related with struts 1.3. I had to rename my indexed getter/setter in my ActionForm :
  <a href="http://www.coderanch.com/t/55172/Struts/Indexed-Properties" rel="nofollow">http://www.coderanch.com/t/55172/Struts/Indexed-Properties</a></p>