-
CSR
-
Resolution: Unresolved
-
P4
-
source
-
minimal
-
No API changes; some overrides are added to allow for specification, which has no impact on users or implementations.
-
Java API
-
SE
Summary
General improvements to specifications of Type
and AnnotatedType
.
Problem
Type
and AnnotatedType
suffer from these few issues:
- Difficult onboarding - the model is not straightforward on first sight, especially their exact correspondence with Java types. It's hard to find the right mapping between Java types,
Type
interfaces, andAnnotatedType
interfaces. - The "owner type" concept has been unclear.
- Confusing specifications, such as that of
ParameterizedType::getRawType
, "class or interface that declares this type". - We don't ask to use
equals
but use ad-hoc docs for equality constraints, such as inTypeVariable
andParameterizedType
.
Solution
- Add Java Language type to modeling interface in the overview for both
Type
andAnnotatedType
.Type
is a type, andAnnotatedType
is a (potentially annotated) use. - Specify the type for different
AnnotatedType
subinterfaces. - Use and describe "inner member class" (from JLS) to replace the "owner type" term for
getOwnerType
, and refer to it whenever needed to describe a member type. - Improve the specification for
ParameterizedType::getActualTypeArguments
to note the existence of owner types; also for annotated version. Mention that this is "as used in source code", which is what "actual" means. - Update
ParameterizedType::getRawType
to refer to raw types and erasure. - Move the equals specification for ParameterizedType to the actual
equals
method, and advocate the use ofequals
for allType
/AnnotatedType
.
Specification
See the attached apidiff. The latest version will be also available at https://cr.openjdk.org/~liach/apidiff/types-facelift/java.base/java/lang/reflect/package-summary.html during active review period.
- csr of
-
JDK-8343251 Facelift for Type and AnnotatedType specifications
- In Progress
- links to