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

generics: bug in type inference when method result used as an argument

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 1.4.2
    • 5.0
    • tools
    • mantis
    • generic
    • solaris_8

    Description

      The following program doesn't compile, but does compile when a temporary
      variable is used to hold the result of the first argument expression.
      There should be no error compiling this.

      class X<T extends Number> {
          static <T extends Number> X<T> f(X<T> a, X<T> b) {
              return f(f(a, b), b);
          }
      }

      Attachments

        Activity

          People

            gafter Neal Gafter
            gafter Neal Gafter
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: