JDK-6868189 : Nested enum class with custom BeanInfo fails
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.beans
  • Affected Version: 7
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2009-08-04
  • Updated: 2011-01-19
  • Resolved: 2009-08-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7 b70Fixed
Related Reports
Relates :  
Relates :  
Description
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);
    }
}

Comments
EVALUATION Method validation should be fixed. The method can be declared in super class.
04-08-2009