lambda: check unhandled exceptions for method references; disable surround with try/catch accordingly (IDEA-98966)

This commit is contained in:
anna
2013-01-14 16:51:11 +01:00
parent 7d80bca02f
commit 1cc7b6ee11
11 changed files with 184 additions and 4 deletions
@@ -0,0 +1,26 @@
// "Surround with try/catch" "true"
public class ExTest {
public static void maybeThrow(String data) throws Ex {
throw new Ex(data);
}
{
Block<String> b = (t) -> {
try {
return ExTest.maybeThrow(t);
} catch (Ex ex) {
<selection>ex.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.</selection>
}
};
}
private static class Ex extends Throwable {
public Ex(String s) {
}
}
}
interface Block<T> {
public void accept(T t);
}
@@ -0,0 +1,20 @@
// "Surround with try/catch" "true"
public class ExTest {
public static void maybeThrow(String data) throws Ex {
throw new Ex(data);
}
{
Block<String> b = (t) -> { return ExTest.may<caret>beThrow(t);};
}
private static class Ex extends Throwable {
public Ex(String s) {
}
}
}
interface Block<T> {
public void accept(T t);
}
@@ -0,0 +1,20 @@
// "Surround with try/catch" "false"
public class ExTest {
public static void maybeThrow(String data) throws Ex {
throw new Ex(data);
}
{
Block<String> b = (t) -> ExTest.may<caret>beThrow(t);
}
private static class Ex extends Throwable {
public Ex(String s) {
}
}
}
interface Block<T> {
public void accept(T t);
}
@@ -0,0 +1,20 @@
// "Surround with try/catch" "false"
public class ExTest {
public static void maybeThrow(String data) throws Ex {
throw new Ex(data);
}
{
Block<String> b = ExTest::may<caret>beThrow(t);
}
private static class Ex extends Throwable {
public Ex(String s) {
}
}
}
interface Block<T> {
public void accept(T t);
}