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

generics: inference failure on assignment conversion for return

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 5.0
    • 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
      */

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: