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

Update usage of "type" terminology in java.lang.Class and java.lang.reflect

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 16
    • Fix Version/s: 16
    • Component/s: core-libs
    • Labels:
      None

      Backports

        Description

        JLS changes for JDK-8246772 include those described in the "Consistent Class and Interface Terminology" document: https://download.java.net/java/early_access/jdk16/docs/specs/class-terminology-jls.html

        This imposes a stricter discipline for distinguishing between *classes and interfaces* vs. *types*. A similar discipline should be applied, where possible, to key Java SE API specs. (Obviously, class and method names used by the APIs themselves must remain unchanged.)

        java.lang.Class and java.lang.reflect should be reviewed to avoid inappropriate use of the term "type". For example, "enum type" and "annotation type" should be replaced with "enum class" and "annotation interface", respectively.

        java.lang.Class has the added complexity of modeling classes and types simultaneously, so in some cases the JLS discipline will not map cleanly to this API.

        The summary of the "Consistent Class and Interface Terminology" document is reproduced here:

        "The following terminology is preferred: a class declaration or an interface declaration is a syntactic structure that introduces a class or an interface, respectively. Various class and interface declarations have different syntactic forms, and can appear in different contexts, per the grammar. An enum declaration introduces a special kind of class, an enum class. An annotation declaration introduces a special kind of interface, an annotation interface."

        "A class type or an interface type is the type of a variable or an expression, where the type names a class or interface. The word type should be avoided when talking about a class or interface itself, or its declaration. For example, "member type" is not appropriate. (As an exception, we continue to use type name to describe a name that refers to a class, interface, or type parameter.)"

        "Each class has a direct superclass type and direct superinterface types. These can be mapped to a direct superclass and direct superinterfaces when the extra information supplied by types (e.g., type arguments) is irrelevant. Through transitive closure, we can talk more generally about superclass types, superinterface types, superclasses, and superinterfaces."

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                jboes Julia Boes (Inactive)
                Reporter:
                dlsmith Dan Smith
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: