I try to compile this code in android studio:
public class Test {
public void test() {
java.util.Optional.of(12).orElseThrow(RuntimeException::new);
}
}
It requires to handle Throwable.
But signature of this method is next:
public <X extends Throwable> T orElseThrow(Supplier<? extends X> exceptionSupplier) throws X
I extract Optional.class from android.jar in Android/Sdk/platforms/android-27 and decompile it with android studio. It has wrong signature:
public <X extends Throwable> T orElseThrow(Supplier<? extends X> exceptionSupplier) throws Throwable
What I do wrong?
Thank you.