mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-07 22:09:38 +07:00
disjunction type equals/hashCode, essential for new inference (IDEA-140150)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user