lambda: convert anonymous to lambda in invalid context with cast; add cast when functional interface type won't be found otherwise (IDEA-90863)

This commit is contained in:
Anna Kozlova
2012-09-03 17:39:49 +04:00
parent 04d0779cfb
commit d71e11473a
5 changed files with 60 additions and 5 deletions

View File

@@ -0,0 +1,8 @@
// "Replace with lambda" "true"
class Test {
{
((Runnable) () -> {
//To change body of implemented methods use File | Settings | File Templates.
}).getClass();;
}
}

View File

@@ -0,0 +1,12 @@
// "Replace with lambda" "true"
class Test {
interface I {
}
interface Bar extends I {
int compare(String o1, String o2);
}
{
I bar2 = (Bar) (o1, o2) -> 0;
}
}

View File

@@ -1,4 +1,4 @@
// "Replace with lambda" "false"
// "Replace with lambda" "true"
class Test {
{
new Ru<caret>nnable() {

View File

@@ -0,0 +1,17 @@
// "Replace with lambda" "true"
class Test {
interface I {
}
interface Bar extends I {
int compare(String o1, String o2);
}
{
I bar2 = new Ba<caret>r() {
@Override
public int compare(String o1, String o2) {
return 0;
}
};
}
}