JDK-8250659 : Clarify in ParameterizedType.getRawType() doc that only Class is returned
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang:reflect
  • Affected Version: 14
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • Submitted: 2020-07-25
  • Updated: 2024-11-06
  • Resolved: 2024-10-30
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
24 b22Fixed
Related Reports
CSR :  
Relates :  
Relates :  
Description
A DESCRIPTION OF THE PROBLEM :
As pointed out in JDK-6255169 the return type of java.lang.reflect.ParameterizedType.getRawType() should have been Class instead of Type. However, this cannot be changed anymore due to binary backward compatibility.

Nonetheless it would be good to clarify in ParameterizedType.getRawType() documentation that the caller can always expect a Class to be returned, but the return type cannot be changed for backward compatibility reasons.
Or if there is actually a valid case where it might not return a Class, then it would be good to describe this case in the documentation.

An example where the return type caused confusion can be seen here:
https://github.com/google/gson/blob/ceae88bd6667f4263bbe02e6b3710b8a683906a2/gson/src/main/java/com/google/gson/internal/%24Gson%24Types.java#L135



Comments
Changeset: 158ae51b Branch: master Author: Chen Liang <liach@openjdk.org> Date: 2024-10-30 05:58:22 +0000 URL: https://git.openjdk.org/jdk/commit/158ae51be0fa5e8f90ad534df3e4f07745a443dc
30-10-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/19978 Date: 2024-07-01 19:20:48 +0000
09-07-2024

Request for changing the documentation of ParameterizedType.getRawType() so that the caller can always expect a Class to be returned, but the return type cannot be changed for backward compatibility reasons. Reference link: https://bugs.openjdk.java.net/browse/JDK-6255169
28-07-2020