I noticed something that seems reasonable, Eclipse JDT, but it seems to be nowhere defined:
public static <T, TException extends Exception> void iterateEx(
Iterable<T> iterable, PredicateEx<T, TException> step) throws TException
{
for (T item : iterable)
{
if (step.testEx(item))
{
ThreadExt.yield(); // sleep 0.001s
}
}
}
When I call a method with a lambda as a PredicateEx step, an undefined TException is considered a RuntimeException if the lambda does not throw anything. I found a piece of code in the Eclipse JDT that did this, but is this a clear output behavior like lambda or just some kind of decision made in a compiler implementation? Since the default exception may also be the default exception instead (= the upper bound of the TException), and I am very concerned that I am going to rewrite all the methods of handling functions in such a way as to correctly handle checked exceptions.
Examples of callers:
iterateEx(listOfResultSet, rs -> true); // throws RuntimeException, no try-catch required
iterateEx(listOfResultSet, rs -> rs.getBoolean("SOME_COLUMN")); // throws SQLException
PredicateEx - Predicate, :
@FunctionalInterface
public interface PredicateEx<T, TException extends Exception>
{
boolean testEx(T t) throws TException;
}