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

Remove accidentally exposed individual methods from Class-File API

XMLWordPrintable

    • source
    • minimal
    • Changes to preview API involves minimal compatibility risk.
    • Java API
    • SE

      Summary

      Remove 3 methods: ModuleAttributeBuilder.build, CodeRelabeler.relabel, and ConstantPoolBuilder.writeBootstrapMethods from the Class-File API.

      Problem

      These 3 methods are only meaningful to the implementation, is not used by any client. They can be used by the implementation without exposure in the API. They would be extra implementation burden if we keep them exposed.

      Solution

      Remove these 3 methods from the public API.

      Specification

      diff --git a/src/java.base/share/classes/java/lang/classfile/attribute/ModuleAttribute.java b/src/java.base/share/classes/java/lang/classfile/attribute/ModuleAttribute.java
      index 721719d2851..9a4c58478ad 100644
      --- a/src/java.base/share/classes/java/lang/classfile/attribute/ModuleAttribute.java
      +++ b/src/java.base/share/classes/java/lang/classfile/attribute/ModuleAttribute.java
      @@ -319,11 +319,5 @@ default ModuleAttributeBuilder opens(PackageDesc pkge, Collection<AccessFlag> op
                * @return this builder
                */
               ModuleAttributeBuilder provides(ModuleProvideInfo provides);
      -
      -        /**
      -         * Builds module attribute.
      -         * @return the module attribute
      -         */
      -        ModuleAttribute build();
           }
       }
      diff --git a/src/java.base/share/classes/java/lang/classfile/components/CodeRelabeler.java b/src/java.base/share/classes/java/lang/classfile/components/CodeRelabeler.java
      index a0ef4d4de9c..ca5ad90389c 100644
      --- a/src/java.base/share/classes/java/lang/classfile/components/CodeRelabeler.java
      +++ b/src/java.base/share/classes/java/lang/classfile/components/CodeRelabeler.java
      @@ -74,12 +74,4 @@ static CodeRelabeler of(Map<Label, Label> map) {
           static CodeRelabeler of(BiFunction<Label, CodeBuilder, Label> mapFunction) {
               return new CodeRelabelerImpl(mapFunction);
           }
      -
      -    /**
      -     * Access method to internal re-labeling function.
      -     * @param label source label
      -     * @param codeBuilder builder to create new labels
      -     * @return target label
      -     */
      -    Label relabel(Label label, CodeBuilder codeBuilder);
       }
      diff --git a/src/java.base/share/classes/java/lang/classfile/constantpool/ConstantPoolBuilder.java b/src/java.base/share/classes/java/lang/classfile/constantpool/ConstantPoolBuilder.java
      index db388c1c73b..a43e6f102ed 100644
      --- a/src/java.base/share/classes/java/lang/classfile/constantpool/ConstantPoolBuilder.java
      +++ b/src/java.base/share/classes/java/lang/classfile/constantpool/ConstantPoolBuilder.java
      @@ -92,14 +92,6 @@ static ConstantPoolBuilder of() {
            */
           boolean canWriteDirect(ConstantPool constantPool);
      
      -    /**
      -     * Writes associated bootstrap method entries to the specified writer
      -     *
      -     * @param buf the writer
      -     * @return false when no bootstrap method entry has been written
      -     */
      -    boolean writeBootstrapMethods(BufWriter buf);
      -
           /**
            * {@return A {@link Utf8Entry} describing the provided {@linkplain String}}
            * If a UTF8 entry in the pool already describes this string, it is returned;

            liach Chen Liang
            liach Chen Liang
            Adam Sotona
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: