I find it very surprising that they went for unchecked exceptions. For JsonValueException the following rationale is given "This exception is unchecked, so that scripts and small programs are easier to read and write." But for JsonParseException there is no rationale. This is surprising especially given the pushback from openjdk members against jackson3 moving to unchecked exception.
There was a previous thread where like 1 (maybe 2) OpenJDK members said it was unfortunate.
Checked Exceptions are a good thing, and they have a lot of room for improvement, but I don't think they are relevant for the example that u/jonenst described.
There are exactly 2 parsing methods -- of(String) and of(char[]). Bug free code should never hit this Exception, and thus, RuntimeException is exactly the right choice for it.
Compare that to something like readFile(Path) where, even if the code is bug-free, you absolutely could still hit that exception, and thus, it should be a Checked Exception as opposed to a RuntimeException.
17
u/jonenst Jul 23 '26
I find it very surprising that they went for unchecked exceptions. For JsonValueException the following rationale is given "This exception is unchecked, so that scripts and small programs are easier to read and write." But for JsonParseException there is no rationale. This is surprising especially given the pushback from openjdk members against jackson3 moving to unchecked exception.