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

inference causes spurious error messages in assignment check

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      unknown
    • OS:
      generic

      Description

      This program doesn't compile:

      class Foo<X> {
         <Z> Foo test() { return null; }
         Foo<?> foo = test();
      }

      The compiler reports the following message:

      Test.java:3: error: incompatible types; no instance(s) of type variable(s) Z exist so that Foo conforms to Foo<?>
         Foo<?> foo = test();
                          ^
        required: Foo<?>
        found: <Z>Foo
        where Z is a type-variable:
          Z extends Object declared in method <Z>test()
      1 error

        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: