JDK-8250642 : Address reliance on default constructors in jdk.jdi
  • Type: CSR
  • Component: core-svc
  • Sub-Component: debugger
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 16
  • Submitted: 2020-07-27
  • Updated: 2020-07-28
  • Resolved: 2020-07-28
Related Reports
CSR :  
Description
Summary
-------

Replace several implicit default constructors of classes in the `jdk.jdi` module with explicit public no-arg constructors.

Problem
-------

Replying on default constructors for a formal API is not recommended.

Solution
--------

Replace the default constructors with equivalent explicit constructors.

Specification
-------------

    --- old/src/jdk.jdi/share/classes/com/sun/jdi/Bootstrap.java	2020-07-27 13:24:06.454000000 -0700
    +++ new/src/jdk.jdi/share/classes/com/sun/jdi/Bootstrap.java	2020-07-27 13:24:05.842000000 -0700
    @@ -38,6 +38,11 @@
      */
     
     public class Bootstrap extends Object {
    +    /**
    +     * Do not call.
    +     */
    +    @Deprecated(since="16", forRemoval=true)
    +    public Bootstrap() {}
     
         /**
          * Returns the virtual machine manager.
    --- old/src/jdk.jdi/share/classes/com/sun/jdi/connect/spi/Connection.java	2020-07-27 13:24:07.506000000 -0700
    +++ new/src/jdk.jdi/share/classes/com/sun/jdi/connect/spi/Connection.java	2020-07-27 13:24:06.878000000 -0700
    @@ -55,6 +55,10 @@
      * @since 1.5
      */
     public abstract class Connection {
    +    /**
    +     * Constructor for subclasses to call.
    +     */
    +    public Connection() {}
     
         /**
          * Reads a packet from the target VM.
    --- old/src/jdk.jdi/share/classes/com/sun/jdi/connect/spi/TransportService.java	2020-07-27 13:24:08.570000000 -0700
    +++ new/src/jdk.jdi/share/classes/com/sun/jdi/connect/spi/TransportService.java	2020-07-27 13:24:07.934000000 -0700
    @@ -79,6 +79,10 @@
      * @since 1.5
      */
     public abstract class TransportService {
    +    /**
    +     * Constructor for subclasses to call.
    +     */
    +    public TransportService() {}
     
         /**
          * Returns a name to identify the transport service.
    @@ -98,6 +102,10 @@
          * The transport service capabilities.
          */
         public static abstract class Capabilities {
    +	/**
    +	 * Constructor for subclasses to call.
    +	 */
    +	public Capabilities() {}
     
             /**
              * Tells whether or not this transport service can support
    @@ -229,6 +237,10 @@
          * service from listening on an address.
          */
         public static abstract class ListenKey {
    +	/**
    +	 * Constructor for subclasses to call.
    +	 */
    +	public ListenKey() {}
     
             /**
              * Returns a string representation of the listen key.


Comments
Moving to Approved.
28-07-2020