-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose class information for TypeReference<T> #24568
Conversation
API changes have been detected in API changes + public Class<T> getClazz() |
final TypeReference<HashMap<String, Object>> typeReference = new TypeReference<HashMap<String, Object>>() {}; | ||
final Map<String, Object> expectedJavaType = new HashMap<String, Object>() {}; | ||
assertEquals(expectedJavaType.getClass().getGenericSuperclass(), typeReference.getJavaType()); | ||
assertNull(typeReference.getClazz()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this should return the non-generic HashMap.class
* @return The {@link Class} representing instance of the {@link TypeReference} created | ||
* using the {@link TypeReference#createInstance(Class)}, otherwise returns {@code null}. | ||
*/ | ||
public Class<T> getClazz() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To follow the other API maybe rename this to getJavaClass
API changes have been detected in API changes + public interface ReferenceManager {
+ ReferenceManager INSTANCE = new ReferenceManagerImpl();
+ void register(Object object, Runnable cleanupAction)
+ }
- public Class<T> getClazz()
+ public Class<T> getJavaClass() |
Fixes #23745