anonymous -> lambda: stop on calls to j.l.Object methods of anonym classes (IDEA-203343)

This commit is contained in:
Anna.Kozlova
2018-11-30 19:11:52 +01:00
parent 8ff5dd251f
commit a9fe383ced
3 changed files with 59 additions and 7 deletions
@@ -0,0 +1,25 @@
// "Fix all 'Anonymous type can be replaced with lambda' problems in file" "true"
import java.util.concurrent.Callable;
class MyTest {
interface A {
void foo();
default void m() {}
}
static {
Callable<Integer> c = new Callable<Integer>() {
@Override
public Integer call() {
return hashCode();
}
};
A a = new A() {
@Override
public void foo() {
m();
}
};
A b = () -> new Object();
}
}
@@ -0,0 +1,30 @@
// "Fix all 'Anonymous type can be replaced with lambda' problems in file" "true"
import java.util.concurrent.Callable;
class MyTest {
interface A {
void foo();
default void m() {}
}
static {
Callable<Integer> c = new Callable<Integer>() {
@Override
public Integer call() {
return hashCode();
}
};
A a = new A() {
@Override
public void foo() {
m();
}
};
A b = new <caret>A() {
@Override
public void foo() {
new Object();
}
};
}
}