Closed Barteks2x closed 4 years ago
This is partly done now; I added typed factory methods (like JsonPrimitive.of(8)
) and now warn in the javadocs that the bare new JsonPrimitive(Object)
may trigger expensive checks. I find that in all of my circumstances method polymorphism can do those checks for free, so I can safely spend some time in that constructor and make this happen.
Currently, accidentally calling
JsonPrimitive
constructor with a wrong type (likeString[]
) can result in weird issues that show up much later in the code. Failing early would be much more useful in that case.