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

Lambda Spec: Support capture when a nested invocation returns an inference variable

    Details

    • Subcomponent:
    • Verification:
      Verified

      Description

      abstract class A2<T>{
         abstract <S> S pick(S x, S y);
         abstract <S1> void m(A2<S1> a)

         void test(A2<Integer> y, A2<Long> x){
              m(pick(x, y));
         }
      }

      Even though the return type of 'pick' is not wildcard-parameterized, for certain instantiations it can be. The greedy inference strategy of JLS 7 would then perform capture on the instantiated return type before performing inference for 'm'. The Lambda Spec instead skips capture (see 18.5.2) and produces an error.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dlsmith Dan Smith
                Reporter:
                dlsmith Dan Smith
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: