You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm still a little confused. I don't see when a FromStringConverter<T> or its caller would need to use the specified cls type instead of its instance's type <T>.
Can you give an example? (I mentioned MethodsStringConverter and EnumStringConverter because those are the only instances that use the specified cls type and I thought they could be implemented without it. All other implementations ignore the cls parameter.)
Edit: I see now that it's used to throw the ClassCastException immediately when the caller attempts to convert to a subclass (tested in TestStringConvert.test_convert_annotationSuperFactorySubViaSub2). Without it, the exception would only be thrown if the caller attempted to assign the result.
This is not a bug, but a general design question.
Why does the
convertFromString
take aClass<? extends T>
parameter?It's used in two places:
EnumStringConverter
-- When would the specifiedcls
differ from the converter'seffectiveType
?MethodsStringConverter
-- When would a caller want to specify a differentcls
param?Thanks, I couldn't find an explanation in the docs or in the source.
The text was updated successfully, but these errors were encountered: