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

inference of thrown variable does not work correctly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • 9
    • tools
    • b134
    • Verified

      This example doesn't compile:

      nterface ThrowableRunnable<E extends Throwable> {
          void compute() throws E;
      }

      public abstract class Overloads {

          public abstract < E extends Exception> void computeException(ThrowableRunnable<E> process) throws E;


          public static <T, E extends Throwable> T compute(ThrowableRunnable<E> action) throws E {
              return null;
          }

          {
              computeException(() -> compute(() -> {}));
          }
      }

            mcimadamore Maurizio Cimadamore
            mcimadamore Maurizio Cimadamore
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: