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

Remove terminally deprecated constructors in java.base

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 15
    • core-libs
    • None
    • source, binary
    • low
    • These explicit constructors being removed were previously default constructors which appear to have been added only by accident. They are assumed to only be called in contrived programs.
    • Java API
    • SE

      Summary

      Remove terminally deprecated constructors in java.lang.reflect.Modifier and java.lang.invoke.ConstantBootstraps.

      Problem

      The constructors that were previously marked as deprecated are in need of removal.

      Solution

      Remove the constructors in question. Note as raised in the core-libs review thread, at least one non-public constructor needs to be added to preserve the effect of removing these public constructors. The implementation will use no-arg private constructors.

      Specification

      --- a/src/java.base/share/classes/java/lang/invoke/ConstantBootstraps.java  Sat Dec 07 09:40:28 2019 +0800
      +++ b/src/java.base/share/classes/java/lang/invoke/ConstantBootstraps.java  Sun Dec 08 10:49:48 2019 -0800
      @@ -40,12 +40,6 @@
        * @since 11
        */
       public final class ConstantBootstraps {
      -    /**
      -     * Do not call.
      -     */
      -    @Deprecated(forRemoval=true, since="14")
      -    public ConstantBootstraps() {}
      -
           // implements the upcall from the JVM, MethodHandleNatives.linkDynamicConstant:
           /*non-public*/
           static Object makeConstant(MethodHandle bootstrapMethod,
      diff -r 31882abe1494 src/java.base/share/classes/java/lang/reflect/Modifier.java
      --- a/src/java.base/share/classes/java/lang/reflect/Modifier.java   Sat Dec 07 09:40:28 2019 +0800
      +++ b/src/java.base/share/classes/java/lang/reflect/Modifier.java   Sun Dec 08 10:49:48 2019 -0800
      @@ -44,13 +44,6 @@
        */
       public class Modifier {
           /**
      -     * Do not call.
      -     */
      -    @Deprecated(forRemoval=true, since="14")
      -    public Modifier() {}
      -
      -
      -    /**
            * Return {@code true} if the integer argument includes the
            * {@code public} modifier, {@code false} otherwise.
            *

            darcy Joe Darcy
            darcy Joe Darcy
            Chris Hegarty, Mandy Chung
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: