-
Enhancement
-
Resolution: Fixed
-
P4
-
14
-
b22
-
generic
A DESCRIPTION OF THE PROBLEM :
As pointed out inJDK-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
As pointed out in
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
- csr for
-
JDK-8335473 Clarify in ParameterizedType.getRawType() doc that only Class is returned
- Closed
- relates to
-
JDK-6255169 (reflect) ParameterizedType.getRawType should return Class<?> not Type
- Closed
-
JDK-8306039 ParameterizedType.getOwnerType() documentation is incomplete about null result
- Closed
- links to
-
Commit(master) openjdk/jdk/158ae51b
-
Review(master) openjdk/jdk/19978