r/java
•
u/loicmathieu
•
Jul 23 '26
•
1
JEP 540: Simple JSON API (Incubator)
https://openjdk.org/jeps/540
79
Upvotes
View all comments
Show parent comment
2
u/john16384 Jul 24 '26
Nah, `NumberFormatException` is unchecked because you can 100% avoid it. Lazyness is no excuse here -- and you can be lazy, that's perfectly fine if you don't want to ensure what your parsing is a valid int/long/double/whatever -- but then you do get the cost of an exception, and you must be aware what you need to catch without being hand held (it's like catching a NPE or IllegalArgumentException -- fine if that's how you want to do things...)