mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 13:02:30 +07:00
testdata to convert anonymous to lambda with overloads
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
// "Replace with lambda" "true"
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
class A {
|
||||
|
||||
public <T> T runReadAction( final Supplier<T> computation) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public <T, E extends Throwable> T runReadAction( ThrowableComputable<T, E> computation) throws E {
|
||||
return null;
|
||||
}
|
||||
|
||||
{
|
||||
runReadAction((Supplier<String>) () -> "");
|
||||
}
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
interface ThrowableComputable<T, E extends Throwable> {
|
||||
T compute() throws E;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// "Replace with lambda" "true"
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
class A {
|
||||
|
||||
public <T> T runReadAction( final Supplier<T> computation) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public <T, E extends Throwable> T runReadAction( ThrowableComputable<T, E> computation) throws E {
|
||||
return null;
|
||||
}
|
||||
|
||||
{
|
||||
runReadAction(new Suppl<caret>ier<String>() {
|
||||
@Override
|
||||
public String get() {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
interface ThrowableComputable<T, E extends Throwable> {
|
||||
T compute() throws E;
|
||||
}
|
||||
Reference in New Issue
Block a user