poly conditional expression type = target type (IDEA-122401)

This commit is contained in:
Anna Kozlova
2014-03-19 19:32:35 +01:00
parent 01fc6fe439
commit e6547e3991
9 changed files with 74 additions and 14 deletions
@@ -0,0 +1,26 @@
import java.util.Comparator;
class NullComparator<T> {
private final Comparator<T> real = null;
private Comparator<? super T> other;
private Comparator<T> another;
NullComparator(Comparator<? super T> real) {
}
public NullComparator<T> thenComparing() {
return new NullComparator<>(real == null ? other : another);
}
Comparator<T> a() {
return null;
}
Comparator<? super T> b() {
return null;
}
public NullComparator<T> thenComparing1() {
return new NullComparator<>(real == null ? a() : b());
}
}