I have a this very simple line of code that is not compiling on 1.8.0_74
Collections.singleton(Optional.of("").orElseThrow(RuntimeException::new));
Compiler error is:
Collections.singleton(Optional.of("").orElseThrow(RuntimeException::new));
^
where X,T are type-variables:
X extends Throwable declared in method orElseThrow(Supplier)
T extends Object declared in class Optional
On the other hand it compiles fine when you break it to separate lines:
String some = Optional.of("").orElseThrow(RuntimeException::new);
Collections.singleton(some);