generalization

This commit is contained in:
ParkerTenBroeck 2025-04-26 10:07:57 -04:00
parent 9b0a9b7ad2
commit 95e7f6a59e
8 changed files with 174 additions and 104 deletions

View file

@ -4,19 +4,23 @@ public interface Future<R> {
@SuppressWarnings("unchecked")
default R poll(Waker waker){
return (R) Pending.INSTANCE;
return (R)Pending.INSTANCE;
}
default R await(){
throw new RuntimeException();
throw new RuntimeException("NO!");
}
static <R> Future<R> ret(R r){
throw new RuntimeException();
throw new RuntimeException("NO!");
}
static void yield() {
throw new RuntimeException("NO!");
}
final class Pending{
private static final Pending INSTANCE = new Pending();
public static final Pending INSTANCE = new Pending();
private Pending(){}
}
}