Trying to benefit from exception transparency
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Tue Aug 10 03:38:02 PDT 2010
The NPE is obviously a bug; the target type is required in this case as
you are accessing a member of 'this' (whose type is the very type that
needs to be inferred).
Maurizio
On 10/08/10 11:09, Florian Weimer wrote:
> import java.sql.SQLException;
>
> class Main {
> public static void main(ConnectionPool pool) throws SQLException {
> pool.run(Txn<Void, void> #{ // ***
> query("SELECT 1");
> });
> }
> }
>
> interface ConnectionPool {
> <T, throws E> T run(Txn<T, E> txn) throws SQLException, E;
> }
>
> abstract class Txn<T, throws E> {
> protected final void query(String statement) throws SQLException {
> }
>
> protected abstract T run() throws E;
> }
>
>
More information about the lambda-dev
mailing list