-
-
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
Exception thrown for incorrectly annotated record changed from InvalidDefinitionException
to MismatchedInputException
#3988
Comments
Looking at the javadoc:
The scenario is providing JSON String to a class that expects JSON Object, and providing JSON Object to a class that expects a JSON String. Isn't that "the wrong input has been provided"? |
What's the scenarios for those? |
Good point! Perhaps my confusion comes from things changing for |
Ooops, wait a minute, I copied the wrong record definitions above. Edit: Fixed, apologies. Both |
now both round-trip, they failed with |
I think you need to double check your scenarios, because when I tried using
Sorry I don't understand what that means, you'd have to explain more than that... 😞 |
@yihtserns Did you see my edit regarding the class definitions above?
Each of the examples can deserialize the value it serialized. I'm reverting the whole thing, just got another failure about
for a record that is not annotated with |
I see there's no change for |
Without direct access to your machine, it's basically impossible to know what you're talking about. Maybe you can create a Github repository with all the (failing) test cases to describe the issue - that's the most effective way for us to be "in-sync" with each other. |
I would suggest actually addressing a small number -- possibly just one -- fail at a time and not bundling together all cases. But aside from that, the general idea would be that:
Whether change in specific case is intentional, valid, or invalid depends on many things of course. Above is just the general guidance. |
It appears as if Jackson behaves wildly different with and without a Java module-info file, even on 2.14.2. I'm not sure it makes sense to look at the behavioral changes between 2.14 and 2.15, if using the Java module system makes the results diverge that much. Reproduction: https://github.com/soc/jackson-repro |
I added the reproduction for
in a second commit in the same repo. |
@soc can you also commit a Maven wrapper into your repo, please? Just want to ensure our environmental settings are close enough:
|
For these test cases in
...in 2.14.2 they failed with:
That
As for
...that is caused by #3724 not covering the scenario where deserialization uses a Record with a constructor property with |
Ok, thanks! Then I'll wait for 2.15.3 and report back! |
This is too convoluted an issue, discussion, to be of much value (IMO), so I'll close it. Relevant, remaining pieces may be re-filed (with possible ref to this one), with clear explanation of intended correct outcome, and not so much on what has changed -- some changes are fine (fixes), others not: but it's perfectly fine to suggest that specific change is wrong (bug/regression). There is no need to ask "why was this changed" if change seems wrong: but there is clear need to clearly indicate both type of exception and message being reported -- latter likely explains how change came about (new validation, regression). |
I have some doubts, is the problem related to constructor property with access=READ_ONLY resolved in 2.15.3 or 2.16?
|
@Mochis Read my note above. If you have remaining problem case that is not covered by an open issue, please file a new, targeted issue for specific problem. |
Thank you @cowtowncoder. Reported here #4119 |
Short update: After I reported this issue, I adapted the test to the behavior on 2.15.2. Now, with the same Jackson version (2.15.2), but updated Java version (to 21) I get similar failures for classes as previously for records:
|
Just checked with 2.16.0 and Java 21: Example
If I adjust the example to
|
What is version IDE is configured with? @soc Asking this because IDE, mvn usually not the problem but the JDK version they load. |
This is closed issue, fwtw. |
Describe the bug
The exception thrown for an incorrectly annotated record has changed.
Version information
2.15.2
To Reproduce
Consider these two examples:
Expected behavior
In 2.14.2
InvalidDefinitionException
was thrown as shown above, with 2.15.3 this changed toMismatchedInputException
.From my understanding
InvalidDefinitionException
was perhaps more "correct"?Additional context
I tried to figure out whether this change was intentional or not, but couldn't find anything in the changelog or issues.
I just wanted to let you know of this change – apologies if this was intentional and I missed it.
(I also found some other behavioral changes in 2.15, but I assume they are intentional – things that weren't deserializing before are now deserializing.)
The text was updated successfully, but these errors were encountered: