-
-
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
Infinite recursion when deserializing a class extending a Map, with a recursive value type. #1658
Comments
This also occurs with 2.8.7 fwiw. |
I think I'd need a reproduction here (code above gets close. Most likely |
Ok, thanks. As I mentioned above you can copy-paste the |
Unfortunately I seem unable to reproduce this with trivial setup... something in there is not re-creating self-recursive type (or comparing equality). Will keep on trying, maybe I can crack this. |
Ok. And now I am actually able to produce a So, unfortunately I will need some help reproducing the failure. |
Thank you for checking. I am confused about "And now I am actually able to produce a |
Was able to confirm with other people - when trying to run the exact example I explained - that they run into the issue too. |
@newkek At this point I need a self-contained test. I was unable to make equality test fail for So: explaining an example is not of use. I need specific code. |
Alright, so I pushed a self-contained test case over here: https://gist.github.com/newkek/d8998836dcdba91cc92bf5d03d46aea7 Important: After more tests, I think it seems like the issue has nothing to do with what I expected. You see that in the public List<Tree<T>> getLeafTrees() That method is never called, and it doesn't do anything in this code snippet. However, it turns out that if I rename the method, or remove the word "get" in the beginning of it, I do not get the SOE anymore. Do you think that this could be due to some kind of "getter inspection" mechanism in the Jackson code by any chance? Please let me know if you manage to reproduce, and thanks for looking into it. |
Much appreciated, thank you! As to why there is very specific path that triggers it: I bet it's a specific side effect -- yes, POJO introspection will eventually discard "methods of no interest", and difference between getter (via naming convention) and other methods is such that one is not introspected further, and one is. It is also interesting that So all in all it is not completely surprising that difference you see exists. |
Hello, I am using jackson-databind 2.8.8, and have a class with an unusual definition (extending a Map, where the values are of the type of the same class). It seems like I am facing an infinite recursion issue.
To reproduce you can re-use or inspire from the class defined here.
Then, when executing the following code:
When calling
readValue()
the mapper throws aStackOverflowException
, here's the stacktrace:Looking briefly into the code, it seems like because of the recursive definition of the class, the equals call in
MapLikeType
may never get out of this loop. Any idea?Thanks.
The text was updated successfully, but these errors were encountered: