disjunction type equals/hashCode, essential for new inference (IDEA-140150)

This commit is contained in:
Anna Kozlova
2015-05-12 11:35:59 +02:00
parent 6817171a69
commit 8b320ba8a7
3 changed files with 52 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Optional;
class Main {
public static class Either<A, B> {
final public Optional<A> _1;
final public Optional<B> _2;
private Either(Optional<A> _1, Optional<B> _2) {
this._1 = _1;
this._2 = _2;
}
public static <A, B> Either<A, B> _2(B value) {
return null;
}
}
public Either<String, Exception> test1() {
try {
new FileOutputStream("").write(1);
return null;
} catch (NullPointerException | IOException e) {
return Either._2(e);
}
}
}