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

spurious error message for inference and type-variable with erroneous bound

    Details

    • Subcomponent:
    • Resolved In Build:
      b128
    • CPU:
      unknown
    • OS:
      generic
    • Verification:
      Verified

      Description

      The following program generates a spurious error message:

      class Foo<X extends Number&NonExistentClass> {
         <X> Foo<X> m() { return null;}
         Foo<?> f = m();
      }

      error:

      TestX.java:2: cannot find symbol
      class Foo<X extends Number&NonExistentClass> {
                                  ^
        symbol: class NonExistentClass
      TestX.java:4: type parameter ? is not within its bound
         Foo<?> f = m();
             ^
      TestX.java:4: type parameters of <X>Foo<X> cannot be determined; no unique maximal instance exists for type variable X with upper bounds <any>,Object
         Foo<?> f = m();
                     ^
        where X is a type-variable:
          X extends Object declared in method <X>m()
      3 errors


      The problematic line is this:

      "instance exists for type variable X with upper bounds <any>,Object"

      an erroneous type is spilling into the error message.

        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: