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

Inference fails for type variable return constraint

XMLWordPrintable

    • b03
    • generic, x86
    • generic, windows_2000, windows_xp
    • Verified

        https://bugs.eclipse.org/bugs/show_bug.cgi?id=98379

        This program doesn't compile:

        public class X {
            <T extends X> T f1() throws Exception{
             return null;
            }
            <U extends X> U f2() throws Exception {
                return f1();
            }
        }

        X.java:6: type parameters of <T>T cannot be determined; no unique maximal instance exists for type variable T with upper bounds U,X
                return f1();
                         ^
        1 error

              ahe Peter Ahe
              ahe Peter Ahe
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: