new inference: same parametrization check tweaked (IDEA-130519)

This commit is contained in:
Anna Kozlova
2014-09-30 15:47:28 +02:00
parent 1f17c4eb23
commit 30b12e3e25
3 changed files with 33 additions and 1 deletions
@@ -0,0 +1,28 @@
import java.util.Optional;
interface Work<T> {
T execute();
}
interface Result {}
class ResultImpl implements Result {}
class Provider {
<T> T doWork(Work<T> work) {
return work.execute();
}
}
class Main {
public static void main(String[] args) {
final Provider provider = new Provider();
final Optional<Result> result = provider.doWork(() -> {
if (args.length > 1) {
return Optional.of(new ResultImpl());
} else {
return Optional.of(new ResultImpl());
}
});
}
}