Skip to content

Instantly share code, notes, and snippets.

@stevenschlansker
Created April 9, 2019 17:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevenschlansker/a23cc97fb6d15fad6ae04bf54511ce62 to your computer and use it in GitHub Desktop.
Save stevenschlansker/a23cc97fb6d15fad6ae04bf54511ce62 to your computer and use it in GitHub Desktop.
public class TestJdk12Regression {
@FunctionalInterface
interface HandleCallback<T, X extends Exception> {
T withHandle(Handle handle) throws X;
}
@FunctionalInterface
interface HandleConsumer<X extends Exception> {
void useHandle(Handle handle) throws X;
}
interface Handle {}
interface Jdbi {
<R, X extends Exception> R withHandle(HandleCallback<R, X> callback) throws X;
<X extends Exception> void useHandle(final HandleConsumer<X> callback) throws X;
}
interface ObjectAssert<ACTUAL> {
void isSameAs(ACTUAL t);
}
static <T> ObjectAssert<T> assertThat(T actual) {
return null;
}
private Jdbi jdbi;
public void nestedUseHandle() {
jdbi.withHandle(h1 -> {
jdbi.useHandle(h2 ->
assertThat(h1).isSameAs(h2));
return null;
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment