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

generics: inference failure on assignment conversion for return

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 5.0
    • Fix Version/s: None
    • Component/s: tools
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      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
      */

        Attachments

          Activity

            People

            • Assignee:
              gafter Neal Gafter
              Reporter:
              ssides Steve Sides
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: