mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-09 09:34:23 +07:00
lambda: replace raw inference from lambda with Object when it doesn't matter (IDEA-101788)
This commit is contained in:
+30
@@ -0,0 +1,30 @@
|
||||
public class CyclicReferenceTest {
|
||||
void test(Match<String, Integer> match) {
|
||||
Match<String, Integer> matcher = match.or(s -> Optional.empty(), i -> 2);
|
||||
Match<String, Integer> matcher1 = match.or(s -> s.startsWith("_") ? Optional.of(1) : Optional.empty(), i -> 2);
|
||||
}
|
||||
}
|
||||
|
||||
class Match<T, V> {
|
||||
public <W> Match<T, V> or(Extractor<T, W> e, Function<W, V> c) {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
interface Extractor<T, W> {
|
||||
Optional<W> unapply(T t);
|
||||
}
|
||||
|
||||
interface Function<W, V> {
|
||||
public V apply(W t);
|
||||
}
|
||||
|
||||
class Optional<W> {
|
||||
public static <T> Optional<T> empty() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <T> Optional<T> of(T value) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user