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

Nested enum class with custom BeanInfo fails

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 7
    • 7
    • client-libs
    • b70
    • generic
    • generic

      A recent change in the tl repository breaks the JMX test javax/management/monitor/AttributeArbitaryDataTypeTest.java. The bug was not present in b65 so must have been introduced since. I have boiled the failing test down to the following:

      import java.beans.*;
      import java.util.*;

      public class X {
          public enum Foo { BAR, BAZ };

          public static class FooBeanInfo extends SimpleBeanInfo {
              public PropertyDescriptor[] getPropertyDescriptors() {
                  try {
                      return new PropertyDescriptor[] {
                          new PropertyDescriptor("name", Foo.class, "name", null) };
                  } catch (IntrospectionException e ) {
                      e.printStackTrace();
                      return null;
                  }
              }
          }

          public static void main (String args[]) throws Exception {
              BeanInfo bi = Introspector.getBeanInfo(Foo.class);
              List<String> names = new ArrayList<String>();
              for (PropertyDescriptor pd : bi.getPropertyDescriptors())
                  names.add(pd.getName());
              if (names.equals(Arrays.asList("name")))
                  System.out.println("Test passed");
              else
                  System.out.println("TEST FAILED: " + names);
          }
      }

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: