The method withConnection is ambiguous if called like this:
Object value = sql2o.withConnection((con, obj) -> methodThatReturnsAValue(con));
Because the lambda could both return a void and an object the compiler doesnt know which version of withConnection to use.
The workaround is to explicitly call the return (or not) like this:
Object value = sql2o.withConnection((con, obj) -> {
return methodThatReturnsAValue(con)
});
Sadly the assignment to the variable is not enough for the compiler to notice.
It would be really nice if it were possible to call it in an unambiguous way.
The method
withConnectionis ambiguous if called like this:Because the lambda could both return a void and an object the compiler doesnt know which version of
withConnectionto use.The workaround is to explicitly call the return (or not) like this:
Sadly the assignment to the variable is not enough for the compiler to notice.
It would be really nice if it were possible to call it in an unambiguous way.