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

regression: return-type inference rejects valid code

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b64
    • CPU:
      unknown
    • OS:
      generic
    • Verification:
      Verified

      Description

      import java.util.Comparator;
      import java.util.List;

      class Test {
         <T extends Comparable<? super T>> Comparator<List<T>> comparator() { return null; }
         static <T extends Comparable<? super T>> void f() {
            Comparator<List<T>> comparator = comparator(); // [*]
         }
      }


      this program is rejected with the following error message:

       type parameters of <T>java.util.Comparator<java.util.List<T>> cannot be determined;
          no unique maximal instance exists for type variable T with upper bounds java.lang.Comparable<? super T>



      See also http://www.netbeans.org/issues/show_bug.cgi?id=163967
      http://www.netbeans.org/issues/show_bug.cgi?id=163969

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: