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

VectorShape#largestShapeFor should have public access

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 25
    • core-libs
    • None
    • minimal
    • Making a package-private method public is minimal to no compatibility risk
    • Java API
    • JDK

      Summary

      Propose making VectorShape#largestShapeFor public to align with existing Vector API documentation elsewhere that references it.

      Problem

      Existing Vector API documentation in the Vector class references this method as though it were public, but it is currently package private.

      Solution

      VectorShape#largestShapeFor will be made public with documentation

      Specification

      diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorShape.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorShape.java
      index 89e0d38bcb0..e14afa70774 100644
      --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorShape.java
      +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorShape.java
      @@ -208,13 +208,22 @@ static VectorShape ofSwitchKey(int sk) {
               }
           }
      
      -    // non-public support for computing preferred shapes
      -
      -    /*package-private*/
      -    static VectorShape largestShapeFor(Class<?> etype) {
      +    /**
      +     * Finds the largest vector shape supported by the current
      +     * platform for the element type {@code etype}.
      +     *
      +     * @param etype the element type
      +     * @return the largest vector shape supported by the platform
      +     *         for {@code etype}
      +     * @throws IllegalArgumentException if no such vector shape exists
      +     *         for the element type or the type is not a valid {@code ETYPE}.
      +     */
      +    public static VectorShape largestShapeFor(Class<?> etype) {
               return VectorShape.forBitSize(getMaxVectorBitSize(etype));
           }
      
      +    // non-public support for computing preferred shapes
      +
           /**
            * Finds the vector shape preferred by the current platform
            * for all vector element types.

            igraves Ian Graves
            nbenalla Nizar Benalla
            Paul Sandoz
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: