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

javac type inference mistmatch between 7 and 8

XMLWordPrintable

      These examples:

      Ex 1:
      abstract class A2<T>{
          abstract <S> S foo(S x, S y);
          abstract <S1> void baz(A2<S1> a);

          void bar(A2<Integer> y, A2<Long> x){
               baz(foo(x, y));
          }
      }

      Ex 2:
      abstract class A<T>{
          abstract <S> S foo(S x, S y);
          <S extends Number & Comparable<? extends Number>> void baz(A<S> a){}

          void bar(A<Long> x, A<Integer> y){
              baz(foo(x, y));
          }
      }

      Ex 3:
      abstract class A1<T>{
          abstract <S> S foo(S x, S y);
          <T extends Number & Comparable<?>, S extends Number & Comparable<?
      extends T>> void baz(A1<S> a){}

          void bar(A1<Long> x, A1<Integer> y){
              baz(foo(x, y));
          }
      }

      compiles in 6 and 7 but fails to compile in 8.

      reported by anna.kozlova_at_jetbrains.com in lambda-dev

            vromero Vicente Arturo Romero Zaldivar
            vromero Vicente Arturo Romero Zaldivar
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: