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

(reflect) AnnotationFormatError thrown when annotation on constructor parameter

XMLWordPrintable

    • b65
    • generic
    • generic
    • Verified

      I get an AnnotationFormatError when registering a JMX MBean with annotation on constructor parameter.
      Test code attached, stack below.
      The annotation used is big (22 terms) : it is made of all that the Java language allows except annotation and array of annotations.
      Seen with Mustang b54, all platforms.
      When the annotation is used at every other place where it is allowed as specified in javax.management.DescriptorKey javadoc, it goes fine. It is only the case you use the annotation for the parameter of a constructor which fails.

      yjoan@curcuma(44)% java6 Defect
      java.lang.annotation.AnnotationFormatError: Parameter annotations don't match number of parameters
      at java.lang.reflect.Constructor.getParameterAnnotations(Constructor.java:636)
      at javax.management.MBeanConstructorInfo.constructorSignature(MBeanConstructorInfo.java:193)
      at javax.management.MBeanConstructorInfo.<init>(MBeanConstructorInfo.java:46)
      at com.sun.jmx.mbeanserver.MBeanIntrospector.findConstructors(MBeanIntrospector.java:359)
      at com.sun.jmx.mbeanserver.MBeanIntrospector.getClassMBeanInfo(MBeanIntrospector.java:323)
      at com.sun.jmx.mbeanserver.MBeanIntrospector.getMBeanInfo(MBeanIntrospector.java:284)
      at com.sun.jmx.mbeanserver.MBeanSupport.<init>(MBeanSupport.java:148)
      at com.sun.jmx.mbeanserver.StandardMBeanSupport.<init>(StandardMBeanSupport.java:81)
      at com.sun.jmx.mbeanserver.Introspector.makeDynamicMBean(Introspector.java:164)
      at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:896)
      at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:312)
      at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:479)
      at Defect.run(Defect.java:41)
      at Defect.main(Defect.java:32)
      TEST FAILED

            darcy Joe Darcy
            yjoan Yves Joan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: