anonym -> lambda, method ref: do not suggest replacement when default method is called out of functional interface context

This commit is contained in:
Anna Kozlova
2014-04-08 13:25:01 +02:00
parent e9996cf64c
commit c8bbd66850
8 changed files with 120 additions and 10 deletions

View File

@@ -0,0 +1,15 @@
// "Replace with lambda" "true"
class Test {
interface InOut {
void run() throws IOException;
default void foo(){}
}
interface InOutEx extends InOut {
InOut bind() {
return () -> {
foo();
};
}
}
}

View File

@@ -0,0 +1,13 @@
// "Replace with lambda" "true"
class Test {
interface InOut {
void run() throws IOException;
static void foo(){}
}
InOut bind() {
return () -> {
InOut.foo();
};
}
}

View File

@@ -0,0 +1,16 @@
// "Replace with lambda" "false"
class Test {
interface InOut {
void run() throws IOException;
default void foo(){}
}
InOut bind() {
return new In<caret>Out() {
@Override
public void run() throws IOException {
foo();
}
};
}
}

View File

@@ -0,0 +1,18 @@
// "Replace with lambda" "true"
class Test {
interface InOut {
void run() throws IOException;
default void foo(){}
}
interface InOutEx extends InOut {
InOut bind() {
return new In<caret>Out() {
@Override
public void run() throws IOException {
foo();
}
};
}
}
}

View File

@@ -0,0 +1,16 @@
// "Replace with lambda" "true"
class Test {
interface InOut {
void run() throws IOException;
static void foo(){}
}
InOut bind() {
return new In<caret>Out() {
@Override
public void run() throws IOException {
foo();
}
};
}
}