JDK-8257636 : Update usage of "type" terminology in java.lang.Class and java.lang.reflect
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang:reflect
  • Affected Version: 16
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2020-12-02
  • Updated: 2021-01-04
  • Resolved: 2020-12-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 16 JDK 17
16 b30Fixed 17Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
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."

Comments
Changeset: 952dc704 Author: Julia Boes <jboes@openjdk.org> Date: 2020-12-17 11:32:58 +0000 URL: https://git.openjdk.java.net/jdk16/commit/952dc704
17-12-2020