-
-
Notifications
You must be signed in to change notification settings - Fork 143
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
Seeming parameter name consideration in jackson-module-scala 2.12.0+ causes new exceptions #505
Comments
Quick note/question: reference to "property-based Creator" suggests that use of
|
this issue seems to be in 2.11 too - I just added a test to the 2.11 suite that fails - based on the PositiveLong scenario. -- b643f57 |
I see zero evidence that jackson-module-scala ever supported JsonCreator annotations on companion objects -- these are the only tested use cases - https://github.com/FasterXML/jackson-module-scala/blob/2.12/src/test/scala/com/fasterxml/jackson/module/scala/deser/CreatorTest.scala |
@pjfanning If you alter
|
unless I've done something profoundly silly, I believe my initial claim still stands -- it is interesting that this seems to be unintended behaviour (unexpected feature?) though. |
@blast-hardcheese could you review #506? - it fails on jackson 2.11 |
On it |
@blast-hardcheese I got the test to pass when I moved it out of the CreatorTest object - pretty strange |
@pjfanning This appears to be due to nesting
which seems to be more of an issue with |
test is merged to 2.11 and a #507 is prepared for 2.12 branch -- so far seems to pass (when expected to fail) |
what you have in that PR is the known good behaviour -- altering the two def apply(value: Long): PositiveLong = ...
def apply(value: String): PositiveLong = ... would exercise the first regression behaviour. |
The second would be class PositiveLong private (val value: Long)
object PositiveLong {
@JsonCreator
def apply(value: Long): PositiveLong = new PositiveLong(value)
} where the |
If you'd like I can add the failing tests to 2.12, I have a pretty good handle on things at this time |
OK, so
It seems as though after 7fce4ca, having both Thanks again for your effort through all of this |
One quick note from core Jackson side: I am thinking of releasing 2.12.2 relatively soon, but if there's a chance this might get addressed would be happy to wait until that happens (or it becomes clear there's a blocker). So I'll add this to things I'll keep an eye on (https://github.com/FasterXML/jackson-future-ideas/wiki/Jackson-Work-in-Progress). |
I've got a bisect running, I'll see where things stand in the morning |
I merged a change that seems to fix @blast-hardcheese test cases |
when I forward fitted to master/jackson3 branch, one of the new tests is broken there - I've marked it as ignored for time being because jackson 3 is not yet planned for release and it is one of 4 or 5 tests that fail in that branch (that pass in jackson 2 branches) |
Confirmed the fix, thank you! |
Related PR that triggered this investigation: guardrail-dev/guardrail#927
Reproducing repo: https://github.com/blast-hardcheese/jackson-module-scala-bug#first-issue
README from reproducing repo
Repo to show
ObjectMapper
withDefaultScalaModule
2.12.0+ causes some new and creative runtime errors.First issue
In the first case, methods annotated with
@JsonCreator
with the same name but different types now require that the parameter names be different, otherwiseSecond issue
In the second case, all
@JsonCreator
's must have different parameter names from the member of the value class, otherwise:The text was updated successfully, but these errors were encountered: