JDK-6337679 : DescriptorKey for an MBean is ignored when it comes from super interface
  • Type: Bug
  • Component: core-svc
  • Sub-Component: javax.management
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Not an Issue
  • OS: generic
  • CPU: generic
  • Submitted: 2005-10-17
  • Updated: 2010-07-29
  • Resolved: 2005-11-24
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 6
6Resolved
Related Reports
Relates :  
Description
The javax.management.DescriptorKey javadoc as of b55 says:

[...]
An annotation such as @Units can be applied to:

    * a Standard MBean or MXBean interface;
    * a method in such an interface;
    * a parameter of a method in a Standard MBean or MXBean interface when that method is an operation (not a getter or setter for an attribute);
    * a public constructor in the class that implements a Standard MBean or MXBean;
    * a parameter in such a constructor. 

Other uses of the annotation are ignored.
[...]

Let's consider an MBean interface defined such way:

public interface WhateverMBean extends FatherInterface {
}

@MyDescriptorKey(blabla...)
public interface FatherInterface {
	// Here in @MyDescriptorKey is used everywhere is possible.
}

The Descriptor of my WhateverMBean instance does not contain what comes with MyDescriptorKey defined on the super interface.
However, the management interface of my WhateverMBean contains well all that comes from FatherInterface.

Comments
EVALUATION Annotations appear to be inherited correctly when methods are not overridden. Annotations on interfaces should not be inherited by subinterfaces. Test failures on constructor parameters need to be described more fully. Suggest logging a documentation bug to clarify the inheritance behaviour and possibly a bug against the constructor parameters if that is indeed incorrect.
24-11-2005

EVALUATION I do not think we want "union" behaviour here. I should be able to restate a method in a child interface with different annotations in order to override the descriptor for the method in the parent interface. Likewise it seems logical that annotations are only taken from the MBean or MXBean interface itself, not from its parent interfaces. On the other hand it is surprising that if you do not restate a method in a child interface, annotations on the method inherited from the parent interface are not taken into account. That would appear to be a bug.
24-11-2005

EVALUATION Both ! Father interface annotation as well as annotation used on methods of that interface are ignored. See Comments.
24-11-2005

EVALUATION Description is unclear. Is the complaint that annotations on the parent interface itself are ignored? Or that annotations on methods in that interface are also ignored?
23-11-2005

SUGGESTED FIX There is two sides: [1] Clarify javadoc. The javadoc for javax.management.DescriptorKey might say inheritance is considered to build the set of valid places where that annotation can be used. What occurs when DescriptorKey is used on several level of hierarchy : union is built ? [2] Change implementation to build the Descriptor with what comes from super interface(s).
17-10-2005