-
-
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
A KeyDeserializer instance defined as private static not found even though added to registered SimpleModule #1447
Comments
@PawelJagus Unfortunately I can not reproduce with code from Jackson 2.8 branch; test passes. without problems. Which version does the problem affect? It could be that fix for either #1441 or #1445 could have resolved this too. |
@cowtowncode I am currently using version 2.8.4 and can reproduce this issue each and every time. |
@cowtowncoder Just ran it with 2.9.0-SNAPSHOT. It is still there. I am trying to test it with 2.8.5-SNAPSHOT as well but currently having some issues with overriding managed versions of Spring Boot. |
Ok. Combining classes into a single junit test class might help too; I simplified code slightly but do not think that should change results. |
Combined that stuff into a single file with JUnit test. StaticKeyDeserializerTest.java
The exception does still occur. |
Thanks. I can reproduce the problem now; not sure what I did differently first. |
Wow. This is interesting... it comes down to having two tests. Almost as if caching was failing... |
I know, right? I do not know if having it as private static does the change here but theoretically it should not make any difference as just the reference to it gets passed and all the methods of this instance's class are public anyway. Unless there is some strange reflection thingy going on somewhere. |
Indeed. And... with some more changes, exception disappears as well. Very weird. Now need to try to undo some changes... |
Lol. Actually, not a mystery after all. It's just the problem with initialization order, after all: First |
OMG, you are right. I would expect an |
Well, in the source code I see that |
@PawelJagus perhaps nulls could be checked against; but one could alternatively consider adding of |
@cowtowncoder Well, I would consider using a method that begins with |
@PawelJagus for now adding |
Matchday.java
TeamPlayer.java
KeyDeserializerStaticTest.java (Probable Bug in Jackson)
The main method of KeyDeserializerStaticTest ends unexpectedly with this runtime exception.
But if I define the custom map key deserializer a bit different semantically, then everything works as expected. It looks like for unknown reason, a map key deserializer instance defined as private static is not visible even if the module it is assigned to is registered.
KeyDeserializerTest.java (OK)
The text was updated successfully, but these errors were encountered: