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

Type error with inner classes of generic classes in functions generic by outer

XMLWordPrintable

    • generic
    • generic

      A DESCRIPTION OF THE PROBLEM :
      The test method fails to compile, as javac believes that getter.get() returns just Object:

      class Scratch {
          static abstract class Getters<T> {
              abstract class Getter {
                  abstract T get();
              }
          }

          static class Usage<T, G extends Getters<T>> {
              public T test(G.Getter getter) {
                  return getter.get();
              }
          }
      }


      FREQUENCY : always


            abimpoudis Angelos Bimpoudis
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: