Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8175794

Type inference regression after JDK-8078093

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 10
    • 9
    • tools
    • b12

    Description

      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

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: