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

Inference producing null type argument

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b08
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Backports

        Description

        When the inference algorithm determines that an inference variable is a subtype of a capture variable without a lower bound, it may choose "null" as the inference result. This is inconsistent with specified behavior.

        <T> Iterable<T> empty(Iterable<? super T> dummy) { return null; }
        {
        String s = empty((Iterable<?>) null).iterator().next(); // no error reported
        Number n = empty((Iterable<?>) null).iterator().next(); // no error reported
        Exception e = empty((Iterable<?>) null).iterator().next(); // no error reported
        empty((Iterable<?>) null).foo(); // error: can't find in Iterable<<null>>
        }

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: