changeset 14448:a21b0e82392d

8139727: Define ConstructorParameters annotation type for MXBeans Reviewed-by: alanb, mchung, dfuchs, abuckley, plevart, mr
author jbachorik
date Wed, 23 Sep 2015 14:25:02 +0200
parents 5afa5a406c20
children 226cd203e48a
files src/java.management/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java src/java.management/share/classes/javax/management/ConstructorParameters.java src/java.management/share/classes/javax/management/MXBean.java test/javax/management/Introspector/AnnotationSecurityTest.java test/javax/management/Introspector/Described.java test/javax/management/Introspector/DescribedMX.java test/javax/management/Introspector/LegacyConstructorPropertiesTest.java test/javax/management/mxbean/AmbiguousConstructorTest.java test/javax/management/mxbean/ExceptionDiagnosisTest.java test/javax/management/mxbean/LeakTest.java test/javax/management/mxbean/MXBeanTest.java test/javax/management/mxbean/PropertyNamesTest.java test/javax/management/mxbean/TigerMXBean.java
diffstat 13 files changed, 272 insertions(+), 76 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.management/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java	Mon Nov 02 10:47:29 2015 -0800
+++ b/src/java.management/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java	Wed Sep 23 14:25:02 2015 +0200
@@ -60,6 +60,7 @@
 
 import javax.management.JMX;
 import javax.management.ObjectName;
+import javax.management.ConstructorParameters;
 import javax.management.openmbean.ArrayType;
 import javax.management.openmbean.CompositeData;
 import javax.management.openmbean.CompositeDataInvocationHandler;
@@ -1132,8 +1133,8 @@
     }
 
     /** Builder for when the target class has a constructor that is
-        annotated with @ConstructorProperties so we can see the correspondence
-        to getters.  */
+        annotated with {@linkplain ConstructorParameters @ConstructorParameters}
+        or {@code @ConstructorProperties} so we can see the correspondence to getters.  */
     private static final class CompositeBuilderViaConstructor
             extends CompositeBuilder {
 
@@ -1141,10 +1142,19 @@
             super(targetClass, itemNames);
         }
 
+        private String[] getConstPropValues(Constructor<?> ctr) {
+            // is constructor annotated by javax.management.ConstructorParameters ?
+            ConstructorParameters ctrProps = ctr.getAnnotation(ConstructorParameters.class);
+            if (ctrProps != null) {
+                return ctrProps.value();
+            } else {
+                // try the legacy java.beans.ConstructorProperties annotation
+                String[] vals = JavaBeansAccessor.getConstructorPropertiesValue(ctr);
+                return vals;
+            }
+        }
+
         String applicable(Method[] getters) throws InvalidObjectException {
-            if (!JavaBeansAccessor.isAvailable())
-                return "@ConstructorProperties annotation not available";
-
             Class<?> targetClass = getTargetClass();
             Constructor<?>[] constrs = targetClass.getConstructors();
 
@@ -1152,12 +1162,13 @@
             List<Constructor<?>> annotatedConstrList = newList();
             for (Constructor<?> constr : constrs) {
                 if (Modifier.isPublic(constr.getModifiers())
-                        && JavaBeansAccessor.getConstructorPropertiesValue(constr) != null)
+                        && getConstPropValues(constr) != null)
                     annotatedConstrList.add(constr);
             }
 
             if (annotatedConstrList.isEmpty())
-                return "no constructor has @ConstructorProperties annotation";
+                return "no constructor has either @ConstructorParameters " +
+                       "or @ConstructorProperties annotation";
 
             annotatedConstructors = newList();
 
@@ -1181,13 +1192,17 @@
             // so we can test unambiguity.
             Set<BitSet> getterIndexSets = newSet();
             for (Constructor<?> constr : annotatedConstrList) {
-                String[] propertyNames = JavaBeansAccessor.getConstructorPropertiesValue(constr);
+                String annotationName =
+                    constr.isAnnotationPresent(ConstructorParameters.class) ?
+                        "@ConstructorParameters" : "@ConstructorProperties";
+
+                String[] propertyNames = getConstPropValues(constr);
 
                 Type[] paramTypes = constr.getGenericParameterTypes();
                 if (paramTypes.length != propertyNames.length) {
                     final String msg =
                         "Number of constructor params does not match " +
-                        "@ConstructorProperties annotation: " + constr;
+                        annotationName + " annotation: " + constr;
                     throw new InvalidObjectException(msg);
                 }
 
@@ -1200,7 +1215,7 @@
                     String propertyName = propertyNames[i];
                     if (!getterMap.containsKey(propertyName)) {
                         String msg =
-                            "@ConstructorProperties includes name " + propertyName +
+                            annotationName + " includes name " + propertyName +
                             " which does not correspond to a property";
                         for (String getterName : getterMap.keySet()) {
                             if (getterName.equalsIgnoreCase(propertyName)) {
@@ -1215,7 +1230,7 @@
                     paramIndexes[getterIndex] = i;
                     if (present.get(getterIndex)) {
                         final String msg =
-                            "@ConstructorProperties contains property " +
+                            annotationName + " contains property " +
                             propertyName + " more than once: " + constr;
                         throw new InvalidObjectException(msg);
                     }
@@ -1224,7 +1239,7 @@
                     Type propertyType = getter.getGenericReturnType();
                     if (!propertyType.equals(paramTypes[i])) {
                         final String msg =
-                            "@ConstructorProperties gives property " + propertyName +
+                            annotationName + " gives property " + propertyName +
                             " of type " + propertyType + " for parameter " +
                             " of type " + paramTypes[i] + ": " + constr;
                         throw new InvalidObjectException(msg);
@@ -1233,7 +1248,8 @@
 
                 if (!getterIndexSets.add(present)) {
                     final String msg =
-                        "More than one constructor has a @ConstructorProperties " +
+                        "More than one constructor has " +
+                        "@ConstructorParameters or @ConstructorProperties " +
                         "annotation with this set of names: " +
                         Arrays.toString(propertyNames);
                     throw new InvalidObjectException(msg);
@@ -1252,10 +1268,10 @@
              * just the bigger constructor.
              *
              * The algorithm here is quadratic in the number of constructors
-             * with a @ConstructorProperties annotation.  Typically this corresponds
-             * to the number of versions of the class there have been.  Ten
-             * would already be a large number, so although it's probably
-             * possible to have an O(n lg n) algorithm it wouldn't be
+             * with a @ConstructorParameters or @ConstructructorProperties annotation.
+             * Typically this corresponds to the number of versions of the class
+             * there have been.  Ten would already be a large number, so although
+             * it's probably possible to have an O(n lg n) algorithm it wouldn't be
              * worth the complexity.
              */
             for (BitSet a : getterIndexSets) {
@@ -1272,8 +1288,9 @@
                                  i = u.nextSetBit(i+1))
                                 names.add(itemNames[i]);
                             final String msg =
-                                "Constructors with @ConstructorProperties annotation " +
-                                " would be ambiguous for these items: " +
+                                "Constructors with @ConstructorParameters or " +
+                                "@ConstructorProperties annotation " +
+                                "would be ambiguous for these items: " +
                                 names;
                             throw new InvalidObjectException(msg);
                         }
@@ -1310,7 +1327,8 @@
 
             if (max == null) {
                 final String msg =
-                    "No constructor has a @ConstructorProperties for this set of " +
+                    "No constructor has either @ConstructorParameters " +
+                    "or @ConstructorProperties annotation for this set of " +
                     "items: " + ct.keySet();
                 throw new InvalidObjectException(msg);
             }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.management/share/classes/javax/management/ConstructorParameters.java	Wed Sep 23 14:25:02 2015 +0200
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2006, 2015 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package javax.management;
+
+import java.lang.annotation.*;
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+/**
+ * <p>
+ * An annotation on a constructor that shows how the parameters of
+ * that constructor correspond to the constructed object's getter
+ * methods.  For example:
+ * </p>
+ * <blockquote>
+ *     <pre>
+ *         public class MemoryUsage {
+ *             // standard JavaBean conventions with getters
+ *             <b>@ConstructorParameters({"init", "used", "committed", "max"})</b>
+ *             public MemoryUsage(long init, long used,
+ *                                long committed, long max) {...}
+ *             public long getInit() {...}
+ *             public long getUsed() {...}
+ *             public long getCommitted() {...}
+ *             public long getMax() {...}
+ *         }
+ *     </pre>
+ * </blockquote>
+ * <p>
+ * The annotation shows that the first parameter of the constructor
+ * can be retrieved with the {@code getInit()} method, the second one with
+ * the {@code getUsed()} method, and so on. Since parameter names are not in
+ * general available at runtime, without the annotation there would be
+ * no way of knowing which parameter corresponds to which property.
+ * </p>
+ * <p>
+ * If a constructor is annotated by the both {@code @java.beans.ConstructorProperties}
+ * and {@code @javax.management.ConstructorParameters} annotations
+ * the JMX introspection will give an absolute precedence to the latter one.
+ * </p>
+ *
+ * @since 1.9
+ */
+@Documented @Target(CONSTRUCTOR) @Retention(RUNTIME)
+public @interface ConstructorParameters {
+    /**
+     * <p>The getter names.</p>
+     *
+     * @return the getter names corresponding to the parameters in the
+     * annotated constructor.
+    */
+    String[] value();
+}
--- a/src/java.management/share/classes/javax/management/MXBean.java	Mon Nov 02 10:47:29 2015 -0800
+++ b/src/java.management/share/classes/javax/management/MXBean.java	Wed Sep 23 14:25:02 2015 +0200
@@ -153,7 +153,7 @@
         <td><pre>
 public class MemoryUsage {
     // standard JavaBean conventions with getters
-    <b>&#64;ConstructorProperties({"init", "used", "committed", "max"})</b>
+    <b>&#64;ConstructorParameters({"init", "used", "committed", "max"})</b>
     public MemoryUsage(long init, long used,
                        long committed, long max) {...}
     long getInit() {...}
@@ -168,8 +168,8 @@
     <p>The definitions are the same in the two cases, except
       that with the MXBean, <code>MemoryUsage</code> no longer needs to
       be marked <code>Serializable</code> (though it can be).  On
-      the other hand, we have added a {@code @ConstructorProperties} annotation
-      to link the constructor parameters to the corresponding getters.
+      the other hand, we have added a {@link ConstructorParameters &#64;ConstructorParameters}
+      annotation to link the constructor parameters to the corresponding getters.
       We will see more about this below.</p>
 
     <p><code>MemoryUsage</code> is a <em>model-specific class</em>.
@@ -850,18 +850,24 @@
         <em>J</em>.</p></li>
 
       <li><p>Otherwise, if <em>J</em> has at least one public
-        constructor with a {@link java.beans.ConstructorProperties
-        ConstructorProperties} annotation, then one
-        of those constructors (not necessarily always the same one)
-        will be called to reconstruct an instance of <em>J</em>.
+        constructor with either {@link javax.management.ConstructorParameters
+        &#64;javax.management.ConstructorParameters} or
+        {@code @java.beans.ConstructoProperties} annotation, then one of those
+        constructors (not necessarily always the same one) will be called to
+        reconstruct an instance of <em>J</em>.
+        If a constructor is annotated with both
+        {@code @javax.management.ConstructorParameters} and
+        {@code @java.beans.ConstructorProperties},
+        {@code @javax.management.ConstructorParameters} will be used and
+        {@code @java.beans.ConstructorProperties} will be ignored.
         Every such annotation must list as many strings as the
         constructor has parameters; each string must name a property
         corresponding to a getter of <em>J</em>; and the type of this
         getter must be the same as the corresponding constructor
         parameter.  It is not an error for there to be getters that
-        are not mentioned in the {@code ConstructorProperties} annotation
-        (these may correspond to information that is not needed to
-        reconstruct the object).</p>
+        are not mentioned in the {@code @ConstructorParameters} or
+        {@code @ConstructorProperties} annotations (these may correspond to
+        information that is not needed to reconstruct the object).</p>
 
         <p>An instance of <em>J</em> is reconstructed by calling a
         constructor with the appropriate reconstructed items from the
@@ -871,9 +877,10 @@
         CompositeData} might come from an earlier version of
         <em>J</em> where not all the items were present.  A
         constructor is <em>applicable</em> if all the properties named
-        in its {@code ConstructorProperties} annotation are present as items
-        in the {@code CompositeData}.  If no constructor is
-        applicable, then the attempt to reconstruct <em>J</em> fails.</p>
+        in its {@code @ConstructorParameters} or {@code @ConstructorProperties}
+        annotation are present as items in the {@code CompositeData}.
+        If no constructor is applicable, then the attempt to reconstruct
+        <em>J</em> fails.</p>
 
         <p>For any possible combination of properties, it must be the
         case that either (a) there are no applicable constructors, or
@@ -909,8 +916,9 @@
       <li><p>Otherwise, <em>J</em> is not reconstructible.</p></li>
     </ol>
 
-    <p>Rule 2 is not applicable to subset Profiles of Java SE that do not
-    include the {@code java.beans} package. When targeting a runtime that does
+    <p>When only {@code @java.beans.ConstructorProperties} is present then
+    rule 2 is not applicable to subset Profiles of Java SE that do not include
+    the {@code java.beans} package. When targeting a runtime that does
     not include the {@code java.beans} package, and where there is a mismatch
     between the compile-time and runtime environment whereby <em>J</em> is
     compiled with a public constructor and the {@code ConstructorProperties}
@@ -957,14 +965,14 @@
         </blockquote>
       </li>
 
-      <li>Public constructor with <code>&#64;ConstructorProperties</code> annotation:
+      <li>Public constructor with <code>&#64;ConstructorParameters</code> annotation:
 
         <blockquote>
           <pre>
 public class NamedNumber {
     public int getNumber() {return number;}
     public String getName() {return name;}
-    <b>&#64;ConstructorProperties({"number", "name"})
+    <b>&#64;ConstructorParameters({"number", "name"})
     public NamedNumber(int number, String name)</b> {
         this.number = number;
         this.name = name;
--- a/test/javax/management/Introspector/AnnotationSecurityTest.java	Mon Nov 02 10:47:29 2015 -0800
+++ b/test/javax/management/Introspector/AnnotationSecurityTest.java	Wed Sep 23 14:25:02 2015 +0200
@@ -27,8 +27,7 @@
  * @summary Test that having a security manager doesn't trigger a
  *          NotCompliantMBeanException
  * @author Daniel Fuchs, Yves Joan
- * @modules java.desktop
- *          java.management
+ * @modules java.management
  * @run clean AnnotationSecurityTest Described UnDescribed DescribedMBean
  *            UnDescribedMBean SqeDescriptorKey DescribedMX DescribedMXBean
  * @run build AnnotationSecurityTest Described UnDescribed DescribedMBean
@@ -40,13 +39,8 @@
 import java.io.File;
 import java.io.IOException;
 
-import java.lang.annotation.Annotation;
 import java.lang.management.ManagementFactory;
-import java.lang.reflect.AnnotatedElement;
 import java.lang.reflect.Method;
-import java.lang.reflect.UndeclaredThrowableException;
-
-import javax.management.JMException;
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
 /**
--- a/test/javax/management/Introspector/Described.java	Mon Nov 02 10:47:29 2015 -0800
+++ b/test/javax/management/Introspector/Described.java	Wed Sep 23 14:25:02 2015 +0200
@@ -25,7 +25,7 @@
  *
  * Used by AnnotationSecurityTest.java
  **/
-import java.beans.ConstructorProperties;
+import javax.management.ConstructorParameters;
 
 /**
  * An MBean used by AnnotationSecurityTest.java
@@ -37,7 +37,7 @@
     public Described() {}
 
     @SqeDescriptorKey("ONE PARAMETER CONSTRUCTOR Described")
-    @ConstructorProperties({"name", "unused"})
+    @ConstructorParameters({"name", "unused"})
     public Described(@SqeDescriptorKey("CONSTRUCTOR PARAMETER name")String name,
             @SqeDescriptorKey("CONSTRUCTOR PARAMETER unused")String unused) {
         this.name = name ;
--- a/test/javax/management/Introspector/DescribedMX.java	Mon Nov 02 10:47:29 2015 -0800
+++ b/test/javax/management/Introspector/DescribedMX.java	Wed Sep 23 14:25:02 2015 +0200
@@ -25,7 +25,7 @@
  *
  * Used by AnnotationSecurityTest.java
  **/
-import java.beans.ConstructorProperties;
+import javax.management.ConstructorParameters;
 
 /**
  * An MXBean used by AnnotationSecurityTest.java
@@ -37,7 +37,7 @@
     public DescribedMX() {}
 
     @SqeDescriptorKey("ONE PARAMETER CONSTRUCTOR DescribedMX")
-    @ConstructorProperties({"name", "unused"})
+    @ConstructorParameters({"name", "unused"})
     public DescribedMX(@SqeDescriptorKey("CONSTRUCTOR PARAMETER name")String name,
             @SqeDescriptorKey("CONSTRUCTOR PARAMETER unused")String unused) {
         this.name = name ;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/management/Introspector/LegacyConstructorPropertiesTest.java	Wed Sep 23 14:25:02 2015 +0200
@@ -0,0 +1,106 @@
+
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.beans.ConstructorProperties;
+import javax.management.ConstructorParameters;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.ObjectName;
+
+/*
+ * @test
+ * @bug 7199353
+ * @summary Asserts that 'java.beans.ConstructorProperties' annotation is still
+ *          recognized and properly handled for custom types mapped to open types.
+ *          Also, makes sure that if the same constructor is annotated by both
+ *          j.b.ConstructorProperties and j.m.ConstructorProperties annotations
+ *          only j.m.ConstructorProperties annotation is considered.
+ * @author Jaroslav Bachorik
+ * @modules java.management
+ *          java.desktop
+ * @run main LegacyConstructorPropertiesTest
+ */
+
+public class LegacyConstructorPropertiesTest {
+    public static class CustomType {
+        private String name;
+        private int value;
+        @ConstructorProperties({"name", "value"})
+        public CustomType(String name, int value) {
+            this.name = name;
+            this.value = value;
+        }
+
+        // if @java.beans.ConstructorProperties would be used
+        // the introspector would choke on this
+        @ConstructorProperties("noname")
+        @ConstructorParameters("name")
+        public CustomType(String name) {
+            this.name = name;
+            this.value = -1;
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public void setName(String name) {
+            this.name = name;
+        }
+
+        public int getValue() {
+            return value;
+        }
+
+        public void setValue(int value) {
+            this.value = value;
+        }
+    }
+
+    public static interface CustomMXBean {
+        public CustomType getProp();
+        public void setProp(CustomType prop);
+    }
+
+    public static final class Custom implements CustomMXBean {
+        private CustomType prop;
+
+        @Override
+        public CustomType getProp() {
+            return prop;
+        }
+
+        @Override
+        public void setProp(CustomType prop) {
+            this.prop = prop;
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        MBeanServer mbs = MBeanServerFactory.createMBeanServer();
+        CustomMXBean mbean = new Custom();
+
+        mbs.registerMBean(mbean, ObjectName.getInstance("test:type=Custom"));
+    }
+}
--- a/test/javax/management/mxbean/AmbiguousConstructorTest.java	Mon Nov 02 10:47:29 2015 -0800
+++ b/test/javax/management/mxbean/AmbiguousConstructorTest.java	Wed Sep 23 14:25:02 2015 +0200
@@ -26,15 +26,13 @@
  * @bug 6175517 6278707
  * @summary Test that ambiguous ConstructorProperties annotations are detected.
  * @author Eamonn McManus
- * @modules java.desktop
- *          java.management
+ * @modules java.management
  * @run clean AmbiguousConstructorTest
  * @run build AmbiguousConstructorTest
  * @run main AmbiguousConstructorTest
  */
 
-import java.beans.ConstructorProperties;
-import java.io.InvalidObjectException;
+import javax.management.ConstructorParameters;
 import javax.management.*;
 
 public class AmbiguousConstructorTest {
@@ -76,13 +74,13 @@
         public int getC() {return 0;}
         public long getD() {return 0;}
 
-        @ConstructorProperties({"a", "b"})
+        @ConstructorParameters({"a", "b"})
         public Unambiguous(byte a, short b) {}
 
-        @ConstructorProperties({"b", "c"})
+        @ConstructorParameters({"b", "c"})
         public Unambiguous(short b, int c) {}
 
-        @ConstructorProperties({"a", "b", "c"})
+        @ConstructorParameters({"a", "b", "c"})
         public Unambiguous(byte a, short b, int c) {}
     }
 
@@ -92,13 +90,13 @@
         public int getC() {return 0;}
         public long getD() {return 0;}
 
-        @ConstructorProperties({"a", "b"})
+        @ConstructorParameters({"a", "b"})
         public Ambiguous(byte a, short b) {}
 
-        @ConstructorProperties({"b", "c"})
+        @ConstructorParameters({"b", "c"})
         public Ambiguous(short b, int c) {}
 
-        @ConstructorProperties({"a", "b", "c", "d"})
+        @ConstructorParameters({"a", "b", "c", "d"})
         public Ambiguous(byte a, short b, int c, long d) {}
     }
 
--- a/test/javax/management/mxbean/ExceptionDiagnosisTest.java	Mon Nov 02 10:47:29 2015 -0800
+++ b/test/javax/management/mxbean/ExceptionDiagnosisTest.java	Wed Sep 23 14:25:02 2015 +0200
@@ -26,11 +26,10 @@
  * @bug 6713777
  * @summary Test that exception messages include all relevant information
  * @author Eamonn McManus
- * @modules java.desktop
- *          java.management
+ * @modules java.management
  */
 
-import java.beans.ConstructorProperties;
+import javax.management.ConstructorParameters;
 import java.io.File;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -131,7 +130,7 @@
     }
 
     public static class CaseProb {
-        @ConstructorProperties({"urlPath"})
+        @ConstructorParameters({"urlPath"})
         public CaseProb(String urlPath) {}
 
         public String getURLPath() {return null;}
--- a/test/javax/management/mxbean/LeakTest.java	Mon Nov 02 10:47:29 2015 -0800
+++ b/test/javax/management/mxbean/LeakTest.java	Wed Sep 23 14:25:02 2015 +0200
@@ -25,8 +25,7 @@
  * @bug 6482247
  * @summary Test that creating MXBeans does not introduce memory leaks.
  * @author Eamonn McManus
- * @modules java.desktop
- *          java.management
+ * @modules java.management
  * @run build LeakTest RandomMXBeanTest MerlinMXBean TigerMXBean
  * @run main LeakTest
  */
--- a/test/javax/management/mxbean/MXBeanTest.java	Mon Nov 02 10:47:29 2015 -0800
+++ b/test/javax/management/mxbean/MXBeanTest.java	Wed Sep 23 14:25:02 2015 +0200
@@ -27,8 +27,7 @@
  * @summary General MXBean test.
  * @author Eamonn McManus
  * @author Jaroslav Bachorik
- * @modules java.desktop
- *          java.management
+ * @modules java.management
  * @run clean MXBeanTest MerlinMXBean TigerMXBean
  * @run build MXBeanTest MerlinMXBean TigerMXBean
  * @run main MXBeanTest
--- a/test/javax/management/mxbean/PropertyNamesTest.java	Mon Nov 02 10:47:29 2015 -0800
+++ b/test/javax/management/mxbean/PropertyNamesTest.java	Wed Sep 23 14:25:02 2015 +0200
@@ -26,14 +26,13 @@
  * @bug 6175517
  * @summary Test the PropertyNames annotation with MXBeans
  * @author Eamonn McManus
- * @modules java.desktop
- *          java.management
+ * @modules java.management
  * @run clean PropertyNamesTest
  * @run build PropertyNamesTest
  * @run main PropertyNamesTest
  */
 
-import java.beans.ConstructorProperties;
+import javax.management.ConstructorParameters;
 import java.util.Collections;
 import java.util.List;
 import javax.management.JMX;
@@ -95,7 +94,7 @@
     }
 
     public static class Point {
-        @ConstructorProperties({"x", "y"})
+        @ConstructorParameters({"x", "y"})
         public Point(int x, int y) {
             this.x = x;
             this.y = y;
@@ -123,17 +122,17 @@
     }
 
     public static class Evolve {
-        @ConstructorProperties({"oldInt"})
+        @ConstructorParameters({"oldInt"})
         public Evolve(int oldInt) {
             this(oldInt, "defaultString");
         }
 
-        @ConstructorProperties({"oldInt", "newString"})
+        @ConstructorParameters({"oldInt", "newString"})
         public Evolve(int oldInt, String newString) {
             this(oldInt, newString, Collections.<String>emptyList());
         }
 
-        @ConstructorProperties({"oldInt", "newString", "newerList"})
+        @ConstructorParameters({"oldInt", "newString", "newerList"})
         public Evolve(int oldInt, String newString, List<String> newerList) {
             this.oldInt = oldInt;
             this.newString = newString;
--- a/test/javax/management/mxbean/TigerMXBean.java	Mon Nov 02 10:47:29 2015 -0800
+++ b/test/javax/management/mxbean/TigerMXBean.java	Wed Sep 23 14:25:02 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,7 +21,7 @@
  * questions.
  */
 
-import java.beans.ConstructorProperties;
+import javax.management.ConstructorParameters;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashSet;
@@ -42,7 +42,7 @@
 public interface TigerMXBean {
 
     class Point {
-        @ConstructorProperties({"x", "y"})
+        @ConstructorParameters({"x", "y"})
         public Point(double x, double y) {
             this.x = x;
             this.y = y;