jdereg/json-io — pull request #24 by KaiHufenbach (2014-11-26 00:42:08+00:00)
Title: Custom Reader for Root Objects without usable Constructor

@jdereg

As I told you we had another problem concerning own custom reader.
As far as I understood, when an object is read, it is first instanciated for analysis purposes. Therefore all constructors are tried, but not a custom reader is used. This can cause problems so an array workaround can be used (see test).
I added the function, that also the custom readers are concerned for the instanciation of the root object.

I have also attached a test case which shows the problem, feel free to try it out. At this point the custom reader instanciates the object twice, once without stack (first time) and the second time with stack (this object should represent the deserialized one).

In my opinion it is also dangerous to try out every constructor with bogus values, as static calls (e.g. for business logic may be made). I would suggest to add a toggle for this feature, so it could be turned off.