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

REGRESSION: MBean introspection rejects interface if it inherits same getter more than once

    Details

    • Subcomponent:
    • Introduced In Build:
      rc
    • Introduced In Version:
      6
    • Resolved In Build:
      b01
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        When an MBean interface inherits two getter methods with the same signature from two different ancestors, the reflection code falsely rejects the MBean interface. This worked fine in JDK 5.0 so it is a regression.

        For example, the following test:

        import java.util.*;
        import java.lang.reflect.*;
        import javax.management.*;

        public class MultiGetTest {
            public static interface FooMBean {
        public MBeanNotificationInfo[] getNotificationInfo();
            }

            public static interface BazMBean {
        public MBeanNotificationInfo[] getNotificationInfo();
            }

            public static interface BarMBean extends FooMBean, BazMBean {
            }

            public static class Bar implements BarMBean {
        public MBeanNotificationInfo[] getNotificationInfo() {
        return null;
        }
            }

            public static void main(String[] args) throws Exception {
        new StandardMBean(new Bar(), BarMBean.class);
            }
        }

        produces the following exception:

        Exception in thread "main" javax.management.NotCompliantMBeanException: Attribute NotificationInfo has more than one getter
                at com.sun.jmx.mbeanserver.MBeanAnalyzer.initMaps(MBeanAnalyzer.java:139)
                at com.sun.jmx.mbeanserver.MBeanAnalyzer.<init>(MBeanAnalyzer.java:100)
                at com.sun.jmx.mbeanserver.MBeanAnalyzer.analyzer(MBeanAnalyzer.java:88)
                at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.getAnalyzer(StandardMBeanIntrospector.java:48)
                at com.sun.jmx.mbeanserver.MBeanIntrospector.getPerInterface(MBeanIntrospector.java:163)
                at com.sun.jmx.mbeanserver.MBeanSupport.<init>(MBeanSupport.java:147)
                at com.sun.jmx.mbeanserver.StandardMBeanSupport.<init>(StandardMBeanSupport.java:81)
                at javax.management.StandardMBean.construct(StandardMBean.java:169)
                at javax.management.StandardMBean.<init>(StandardMBean.java:200)
                at MultiGetTest.main(MultiGetTest.java:24)

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  emcmanus Eamonn McManus
                  Reporter:
                  emcmanus Eamonn McManus
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: