Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/exceptions/IDEA116441.java
anna f7fd8525b9 lambda: catch exception by SAM method substitution (IDEA-116441)
(cherry picked from commit 0bce39590bdcc6e6a74c0dcedbb02add3333e685)
2013-11-25 16:47:34 +01:00

21 lines
479 B
Java

import java.io.IOException;
class Main48 {
public static void main(String[] args) throws Exception {
templateMethod(( ) -> {
throw new IOException();
});
}
static void templateMethod(RunnableWithException<IOException> r) {
try {
r.run();
} catch (IOException e) {
e.printStackTrace();
}
}
interface RunnableWithException<E extends Exception> {
void run() throws E;
}
}