-
CSR
-
Resolution: Approved
-
P4
-
None
-
behavioral
-
minimal
-
Explicitly document existing behavior.
-
Java API
-
SE
Summary
Add explicit specification to Types.directSupertypes
on how java.lang.Object
is handled.
Problem
java.lang.Object
is a special case in for the direct super type relationship. The specification for Types.directSupertypes does not explicitly mention this case; although the correct behavior can be inferred from the existing specification.
Solution
Add explicit text stating java.lang.Object
has no direct super types.
Specification
diff --git a/src/java.compiler/share/classes/javax/lang/model/util/Types.java b/src/java.compiler/share/classes/javax/lang/model/util/Types.java
index 02c7085bd8c..cd5a9a848a9 100644
--- a/src/java.compiler/share/classes/javax/lang/model/util/Types.java
+++ b/src/java.compiler/share/classes/javax/lang/model/util/Types.java
@@ -133,6 +133,10 @@ public interface Types {
* will appear last in the list. For an interface type with no direct
* super-interfaces, a type mirror representing {@code java.lang.Object}
* is returned.
+ * The type {@code java.lang.Object} has no direct supertype
+ * ({@jls 8.1.4}, {@jls 8.1.5}) so an empty list is returned for the direct
+ * supertypes of a type mirror representing {@code
+ * java.lang.Object}.
*
* @param t the type being examined
* @return the direct supertypes, or an empty list if none
- csr of
-
JDK-8296287 Improve documentation for Types.directSupertypes()
-
- Resolved
-