fork download
  1. import java.util.stream.Stream;
  2. import java.util.function.Function;
  3. import java.util.function.Predicate;
  4. import java.util.Optional;
  5.  
  6. class Interesting {
  7. public <T> Optional<? extends Predicate<? super T>> with(Stream<Predicate<? super T>> predicates) {
  8. return predicates.map(Function.identity()).reduce(Predicate::or);
  9. }
  10.  
  11. public static void main(String[] args) {}
  12. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:8: error: incompatible types: invalid method reference
    return predicates.map(Function.identity()).reduce(Predicate::or);
                                                      ^
    incompatible types: Predicate<CAP#1> cannot be converted to Predicate<? super CAP#2>
  where T is a type-variable:
    T extends Object declared in method <T>with(Stream<Predicate<? super T>>)
  where CAP#1,CAP#2 are fresh type-variables:
    CAP#1 extends Object super: T from capture of ? super T
    CAP#2 extends Object super: T from capture of ? super T
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
stdout
Standard output is empty