Type inference regression after JDK-8078093

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 10
    • Affects Version/s: 9
    • Component/s: tools
    • b12

      The following program is rejected by javac after the fix for JDK-8078093:

      ===
      import java.util.concurrent.ExecutorService;

      abstract class T {
        void f(ExecutorService s) {
          s.submit(() -> run(() -> {}));
        }

        abstract <E extends Throwable> void run(ThrowableRunnable<E> action) throws E;

        public interface ThrowableRunnable<T extends Throwable> {
          void run() throws T;
        }
      }
      ===

      javac full version "9-ea+157"

      T.java:5: error: incompatible types: inference variable T has incompatible bounds
          s.submit(() -> run(() -> {}));
                  ^
          upper bounds: Object
          lower bounds: void
        where T is a type-variable:
          T extends Object declared in method <T>submit(Callable<T>)
      1 error

            Assignee:
            Vicente Arturo Romero Zaldivar
            Reporter:
            Liam Miller-Cushon
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: