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

inference causes spurious error messages in assignment check

XMLWordPrintable

    • unknown
    • generic

      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

            mcimadamore Maurizio Cimadamore
            mcimadamore Maurizio Cimadamore
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: