-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
StdValueInstantiator.createFromInt does not fallback on Object constructor given a int #5030
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
Comments
You seem to have forgotten (or perhaps be unaware of the need for?) adding Adding that annotation (possibly as |
Another thing you might want to do: use
|
Yes, but no. Yes, as I indeed barely never used No, because it not fully satisfactory. From a functional perspective :
I adjusted the reproduction case to reflect current implementation of this need. Building the reproduction case, I note:
Indeed. Thanks. I sinmplified the reproduction case (and my own code) with this. |
Well, use of So to use constructor that takes single |
Thanks. I understand that One advantage of my considered design is to enable While working on this (trying hard not to add the few additional constructors), I've hit some weird/unexpected behavior:
Should I open a specific ticket?
|
I am not sure understand the ask here; example is getting way too complicated. But as to a new ticket: you can if you want to. I doubt we'll be adding support for Yet More Constructor detection as in general the goal is to support use of just 2 Creators (constructor / factory methods):
but due to legacy reasons, there are those String/int/long/double/boolean -taking delegating constructors that are additionally detected. As such, use of general-purpose delegating Creator that takes intermediate/general type like |
Thanks @cowtowncoder . My case in indeed quite specific. I open #5035 for an unexpected behavior, popped by this issue, but unrelated with |
Search before asking
Describe the bug
I consider a custom type with an
Object
property. The object is serialized through its interface with the help of an@JsonTypeInfo
, and a custom@JsonSerialize
to represent the custom type only given the inner property.The custom type has an
Object
constructor, but for some reason, I need to add a constructor for each primitive type (aString
constructor, anint
constructor, etc).I would expect the
Object
constructor to be good-enough to handle any input type.Relates with:
double
#4453BigInteger
andBigDecimal
creators inStdValueInstantiator
#2215Version Information
2.18.2
Reproduction
(The reproduction scenario is probably unecessarily cumbersome, I kept some specifities of from actual codebase).
Expected behavior
I would expect the
Object
constructor (if it exists) to be a fallback to all types, including primitive types.Additional context
No response
The text was updated successfully, but these errors were encountered: