JDK-8343251 : Facelift for Type and AnnotatedType specifications
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang:reflect
  • Affected Version: 24
  • Priority: P4
  • Status: In Progress
  • Resolution: Unresolved
  • Submitted: 2024-10-30
  • Updated: 2024-11-04
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 24
24Unresolved
Related Reports
CSR :  
Duplicate :  
Description
The Type and AnnotatedType hierarchies have been enigmatic to new users: users have no clue how to categorize arbitrary type objects, when it is safe to cast to more specific types, and the exact conditions for method contracts.

A manifest is JDK-8306039, where people are massively confused by the conditions for `ParameterizedType::getOwnerType` to return null.

To fix these problems, I consulted the JLS, used some terms from there and added JLS links to make the definitions concise and accurate.

Here are some actions:
1. Add section for hierarchy overview for both Type and AnnotatedType
2. Specify the underlying type for different AnnotatedType subinterfaces
3. Define "inner member class" for `getOwnerType`, and refer to it in `AnnotatedType::getAnnotatedOwnerType`.
4. Improve the specification for `ParameterizedType::getActualTypeArguments` to note the existence of owner types; also for annotated version
5. Minor improvements to `ParameterizedType::getRawType`
6. Move the equals specification for `ParameterizedType` to the actual `equals` method.
Comments
A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/19977 Date: 2024-07-01 18:22:48 +0000
30-10-2024