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

Address reliance on default constructors in java.management

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 16
    • core-svc
    • None
    • behavioral
    • minimal
    • Explicit constructor added that is deprecated for removal.
    • Java API
    • SE

      Summary

      A concise description of the proposed change. The description should be one to two sentences long and written to be reusable in documents aggregating changes for a release.

      Problem

      A brief description of the problem, optionally including the motivation for developing a solution.

      Solution

      An overview of the solution. Alternative solutions may be discussed; links to rationale documents or review threads welcome to provide additional background to reviewers.

      Specification

      diff -r b3af0bdfb85a src/java.management/share/classes/javax/management/AttributeChangeNotificationFilter.java
      --- a/src/java.management/share/classes/javax/management/AttributeChangeNotificationFilter.java Fri Jul 24 13:49:38 2020 -0700
      +++ b/src/java.management/share/classes/javax/management/AttributeChangeNotificationFilter.java Fri Jul 24 21:25:35 2020 -0700
      @@ -50,6 +50,10 @@
            */
           private Vector<String> enabledAttributes = new Vector<String>();
      
      +    /**
      +     * Constructs an {@code AttributeChangeNotificationFilter}.
      +     */
      +    public AttributeChangeNotificationFilter() {}
      
           /**
            * Invoked before sending the specified notification to the listener.
      diff -r b3af0bdfb85a src/java.management/share/classes/javax/management/DefaultLoaderRepository.java
      --- a/src/java.management/share/classes/javax/management/DefaultLoaderRepository.java   Fri Jul 24 13:49:38 2020 -0700
      +++ b/src/java.management/share/classes/javax/management/DefaultLoaderRepository.java   Fri Jul 24 21:25:35 2020 -0700
      @@ -51,6 +51,11 @@
       @Deprecated
       public class DefaultLoaderRepository {
           /**
      +     * Constructs an {@code DefaultLoaderRepository}.
      +     */
      +    public DefaultLoaderRepository() {}
      +
      +    /**
            * Go through the list of class loaders and try to load the requested class.
            * The method will stop as soon as the class is found. If the class
            * is not found the method will throw a <CODE>ClassNotFoundException</CODE>
      diff -r b3af0bdfb85a src/java.management/share/classes/javax/management/NotificationFilterSupport.java
      --- a/src/java.management/share/classes/javax/management/NotificationFilterSupport.java Fri Jul 24 13:49:38 2020 -0700
      +++ b/src/java.management/share/classes/javax/management/NotificationFilterSupport.java Fri Jul 24 21:25:35 2020 -0700
      @@ -69,6 +69,11 @@
      
      
           /**
      +     * Constructs a {@code NotificationFilterSupport}.
      +     */
      +    public NotificationFilterSupport() {}
      +
      +    /**
            * Invoked before sending the specified notification to the listener.
            * <BR>This filter compares the type of the specified notification with each enabled type.
            * If the notification type matches one of the enabled types,
      diff -r b3af0bdfb85a src/java.management/share/classes/javax/management/QueryEval.java
      --- a/src/java.management/share/classes/javax/management/QueryEval.java Fri Jul 24 13:49:38 2020 -0700
      +++ b/src/java.management/share/classes/javax/management/QueryEval.java Fri Jul 24 21:25:35 2020 -0700
      @@ -42,6 +42,11 @@
               new InheritableThreadLocal<MBeanServer>();
      
           /**
      +     * Constructor for subclasses to call.
      +     */
      +    public QueryEval() {}
      +
      +    /**
            * <p>Sets the MBean server on which the query is to be performed.
            * The setting is valid for the thread performing the set.
            * It is copied to any threads created by that thread at the moment
      diff -r b3af0bdfb85a src/java.management/share/classes/javax/management/loading/DefaultLoaderRepository.java
      --- a/src/java.management/share/classes/javax/management/loading/DefaultLoaderRepository.java   Fri Jul 24 13:49:38 2020 -0700
      +++ b/src/java.management/share/classes/javax/management/loading/DefaultLoaderRepository.java   Fri Jul 24 21:25:35 2020 -0700
      @@ -56,6 +56,11 @@
       public class DefaultLoaderRepository {
      
           /**
      +     * Constructs a {@code DefaultLoaderRepository}.
      +     */
      +    public DefaultLoaderRepository() {}
      +
      +    /**
            * Go through the list of class loaders and try to load the requested
            * class.
            * The method will stop as soon as the class is found. If the class
      diff -r b3af0bdfb85a src/java.management/share/classes/javax/management/monitor/Monitor.java
      --- a/src/java.management/share/classes/javax/management/monitor/Monitor.java   Fri Jul 24 13:49:38 2020 -0700
      +++ b/src/java.management/share/classes/javax/management/monitor/Monitor.java   Fri Jul 24 21:25:35 2020 -0700
      @@ -76,6 +76,11 @@
           extends NotificationBroadcasterSupport
           implements MonitorMBean, MBeanRegistration {
      
      +    /**
      +     * Constructor for subclasses to call.
      +     */
      +    public Monitor() {}
      +
           /*
            * ------------------------------------------
            *  PACKAGE CLASSES
      diff -r b3af0bdfb85a src/java.management/share/classes/javax/management/relation/RoleStatus.java
      --- a/src/java.management/share/classes/javax/management/relation/RoleStatus.java   Fri Jul 24 13:49:38 2020 -0700
      +++ b/src/java.management/share/classes/javax/management/relation/RoleStatus.java   Fri Jul 24 21:25:35 2020 -0700
      @@ -33,6 +33,12 @@
        */
       public class RoleStatus {
      
      +    /**
      +     * Do not call.
      +     */
      +    @Deprecated(since="16", forRemoval=true)
      +    public RoleStatus() {}
      +
           //
           // Possible problems
           //

            darcy Joe Darcy
            darcy Joe Darcy
            Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: