2 ms·
You could, but I'd argue it's a dodgy thing to do. In general, the idea behind RuntimeException is that they're not checked because they're preventable errors t
by mumblemumble 6y ago
You could, but I'd argue it's a dodgy thing to do. In general, the idea behind RuntimeException is that they're not checked because they're preventable errors that you should be able to avoid having in the first place, and it's therefore unwise to try to recover from them because they indicate that you've got a bug and the application may be in an untrustworthy state.
Granted, that idea itself gets a bit dodgy. In the case of Collection<T>, for example, an isReadOnly method was not supplied, so we haven't really been given any good way to tell ahead of time if a particular collection instance supports mutation.
- dllthomas 6y agoAnd even then, the linter will only help if it's your code generating the exception.