There are no technical limitations. they could create functional interfaces that declare checked exceptions in their contract just as they did with Callable. The only reason they haven't done that it's because they DO NOT WANT to. Doing so would imply to pollute the JDK with dozens of new functional interfaces and to refactor hundred of API to support the new contracts through method overloading. That would also require to improve the compiler to recognize between interfaces with similar contracts.
There are no technical limitations. they could create functional interfaces that declare checked exceptions in their contract just as they did with Callable. the only reason they do not do that it's because they DO NOT WANT to pollute the JDK with them, and all the refactor required in the API to get make use of these new functional interfaces.
Plus, it wouldn't solve the problem. Being forced to write a try-catch when you aren't using functions that actually throw anything would be a worse situation than we have now.
View all comments
Show parent comment
2
u/Ewig_luftenglanz Oct 05 '25 edited Oct 05 '25
There are no technical limitations. they could create functional interfaces that declare checked exceptions in their contract just as they did with Callable. The only reason they haven't done that it's because they DO NOT WANT to. Doing so would imply to pollute the JDK with dozens of new functional interfaces and to refactor hundred of API to support the new contracts through method overloading. That would also require to improve the compiler to recognize between interfaces with similar contracts.