fork(1) download
  1. import java.util.List;
  2.  
  3. public class Main {
  4. interface Interface1<T> {}
  5. interface Interface2<T> extends Interface1<T> {}
  6. static class Bound {}
  7. interface BoundedI1<T extends Bound> extends Interface1<T> {}
  8. interface BoundedI2<T extends Bound> extends Interface2<T> {}
  9.  
  10. public static void main(String[] args) {
  11. test((List<BoundedI2<?>>) null);
  12. test2((List<BoundedI2<?>>) null);
  13. }
  14.  
  15. public static void test(List<? extends Interface2<? extends Bound>> list) { test2(list); }
  16.  
  17. public static void test2(List<? extends Interface1<? extends Bound>> list) {}
  18. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:12: error: method test2 in class Main cannot be applied to given types;
        test2((List<BoundedI2<?>>) null);
        ^
  required: List<? extends Interface1<? extends Bound>>
  found: List<BoundedI2<?>>
  reason: actual argument List<BoundedI2<?>> cannot be converted to List<? extends Interface1<? extends Bound>> by method invocation conversion
1 error
stdout
Standard output is empty