-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Consider removing "optimization" of handling Class<?> from TypeFactory.fromParamType #3443
Comments
Hmmmh. I would be open to removing that specific case since compared to others it is less likely to actually improve performance ( If you change this & run unit tests does the unit test suite still pass? I'd suspect it does. Also: if you want, a PR against |
(labeling as "need-test-case" just as a reminder that changed behavior should be tested to avoid future regression etc -- not that I wouldn't believe behavior currently is as described). |
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. |
I created a PR, but I think I messed up somehow, sorry for that (first time doing a PR here on github) - it's at #3445 |
Fixed, to be included in 2.14.0. |
I 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 fromEnum
,Comparable
andClass
. While I agree that for the first two the type arguments aren't really useful, they sometimes would be forClass
.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 subclassingTypeFactory
from another package is pretty painful thanks to its "mutant factory methods").The text was updated successfully, but these errors were encountered: