ensure anonymous is not converted to lambda/method ref if it contains inner classes or class initializers

(cherry picked from commit 32afe318e3bacd714f3e0b49d8f904402b17a9c2)
This commit is contained in:
Anna Kozlova
2015-03-11 20:27:02 +01:00
parent 4fb47480f8
commit f6de981477
4 changed files with 46 additions and 4 deletions
@@ -0,0 +1,22 @@
// "Replace with lambda" "false"
import java.util.*;
class Test2 {
interface I<X> {
X foo(List<X> list);
}
static <T> I<T> bar(I<T> i){return i;}
{
bar(new I<Stri<caret>ng>() {
{
System.out.println("hi!");
}
@Override
public String foo(List<String> list) {
return null;
}
});
}
}
@@ -0,0 +1,20 @@
// "Replace with lambda" "false"
import java.util.*;
class Test2 {
interface I<X> {
X foo(List<X> list);
}
static <T> I<T> bar(I<T> i){return i;}
{
bar(new I<Stri<caret>ng>() {
class UF {}
@Override
public String foo(List<String> list) {
return null;
}
});
}
}