change signature: expand expr lambda to block lambda when exception should be caught; don't expand method ref to lambda when only unchecked exceptions were added (IDEA-152386)

This commit is contained in:
Anna.Kozlova
2016-04-28 11:39:38 +02:00
parent bb09d3c6f3
commit bebf4975e6
8 changed files with 124 additions and 4 deletions
@@ -0,0 +1,19 @@
import java.util.function.Consumer;
class Action {
public void ac<caret>ting(String s) {
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) -> a.acting(s));
}
}
@@ -0,0 +1,26 @@
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) {
e.printStackTrace();
}
});
}
}
@@ -0,0 +1,19 @@
import java.util.function.Consumer;
class Action {
public void ac<caret>ting(String s) {
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", a::acting);
}
}
@@ -0,0 +1,19 @@
import java.util.function.Consumer;
class Action {
public void acting(String s) throws NullPointerException {
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", a::acting);
}
}