Consider removing "optimization" of handling Class<?> from TypeFactory.fromParamType
See original GitHub issueI wanted to create a custom deserializer for Class<? extends Something>
that would check the upper bound and throw an exception if it did not match. Easy enough, I thought, just a simple contextual deserializer.
But, the type kept coming in as a SimpleType
without any generic arguments.
After some digging, I found that it is because of a special-case in TypeFactory.fromParamType
that strips the generic arguments from Enum
, Comparable
and Class
. While I agree that for the first two the type arguments aren’t really useful, they sometimes would be for Class
.
Please consider whether these “performance reasons” are worth the unintuitive (and possibly undocumented?) behavior.
Currently, the only way is to subclass TypeFactory
to skip the special handling (but subclassing TypeFactory
from another package is pretty painful thanks to its “mutant factory methods”).
Issue Analytics
- State:
- Created a year ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
Great, thanks for the heads up! I’ll run the change through the test suite and try to create a PR if no problems pop up.
Fixed, to be included in 2.14.0.