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

API for Class::permittedSubclasses should clarify if returned elements are ordered or not

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 15
    • core-libs
    • None
    • behavioral
    • minimal
    • Java API

      Summary

      API for java.lang.Class::permittedSubclasses should be updated to clarify if clients should assume a given order in the returned elements or not

      Problem

      API for java.lang.Class::permittedSubclasses doesn't specify if returned elements have a given order or not

      Solution

      Update java.lang.Class::permittedSubclasses' API to clarify that the returned elements have no assumed order

      Specification

      diff -r 0c175b982c0b src/java.base/share/classes/java/lang/Class.java
      --- a/src/java.base/share/classes/java/lang/Class.java  Tue Jun 09 10:31:05 2020 -0400
      +++ b/src/java.base/share/classes/java/lang/Class.java  Wed Jun 10 13:12:45 2020 -0400
      @@ -4393,9 +4393,11 @@
            *           features of the Java language.}
            *
            * Returns an array containing {@code ClassDesc} objects representing all the
      -     * direct subclasses or direct implementation classes permitted to extend or implement this class or interface
      -     * if it is sealed. If this {@code Class} object represents a primitive type, {@code void}, an array type,
      -     * or a class or interface that is not sealed, an empty array is returned.
      +     * direct subclasses or direct implementation classes permitted to extend or
      +     * implement this class or interface if it is sealed. The order of such elements
      +     * is unspecified. If this {@code Class} object represents a primitive type,
      +     * {@code void}, an array type, or a class or interface that is not sealed,
      +     * an empty array is returned.
            *
            * @return an array of class descriptors of all the permitted subclasses of this class or interface
            *

            vromero Vicente Arturo Romero Zaldivar
            dbessono Dmitry Bessonov
            Chris Hegarty, Gavin Bierman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: