mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-25 19:29:30 +07:00
lambda: check unhandled exceptions for method references; disable surround with try/catch accordingly (IDEA-98966)
This commit is contained in:
+26
@@ -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);
|
||||
}
|
||||
+20
@@ -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);
|
||||
}
|
||||
+20
@@ -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);
|
||||
}
|
||||
+20
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user