Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/changeSignature/AddExceptionToCatchInOneLineLambda_after.java
Anna Kozlova 724ed16f6f [java] replace default catch block template (IDEA-161593)
`throw e` won't fix the compilation error, comment - is not really better than empty catch block.

GitOrigin-RevId: ea002c332900b032392e766f3dd13fe3258ad49c
2022-01-14 20:39:23 +00:00

26 lines
518 B
Java

import java.io.IOException;
import java.util.function.Consumer;
class Action {
public void acting(String s) throws IOException {
System.out.println(s);
}
}
class Client {
public static void consumer(String val, Consumer<String> func) {
func.accept(val);
}
public static void main(String[] args) {
Action a = new Action();
consumer("hello", (s) -> {
try {
a.acting(s);
} catch (IOException e) {
throw new RuntimeException(e);
}
});
}
}