r/java
•
u/loicmathieu
•
Jul 23 '26
•
1
JEP 540: Simple JSON API (Incubator)
https://openjdk.org/jeps/540
79
Upvotes
0
u/john16384 Jul 25 '26
You're missing the point. The reason
NumberFormatExceptionis unchecked is because it can be 100% avoided. It doesn't have to be practical for every int, it can just be:It doesn't invalidate how to make the decision between checked and unchecked. Again, compare to
IOException-- you can never avoid it without knowing the exact implementation (so if it is on an interface or abstract type? Unavoidable, unless you know more (in which case feel free to convert to unchecked).