generics: inference failure on assignment conversion for return

XMLWordPrintable

    • Type: Bug
    • Resolution: Not an Issue
    • Priority: P4
    • None
    • Affects Version/s: 5.0
    • Component/s: tools
    • generic
    • generic

      import java.util.List;

      class IncompleteInfer
      {
          public <T> List<T> nil() { return null; }
          public <T> T getHead(List<T> x) { return null; }

          IncompleteInfer()
      {
      String s = getHead(nil());
          }
      }

      /* error mesasage
      IncompleteInfer.java:16: incompatible types
      found : java.lang.Object
      required: java.lang.String
                 String s = getHead(nil());
                                   ^
      1 error
      */

            Assignee:
            Neal Gafter (Inactive)
            Reporter:
            Steve Sides (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: