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

inference: uninferred type args should follow their upper bounds

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 7
    • specification
    • None
    • generic
    • generic

      javac accepts this case:

      class X {
        static <T,U extends Number> void f(T x) { }
        public static void main(String[] args) { f(new Integer(37)); }
      }

      It is claimed that, according to the spec, a type argument that cannot be inferred from the call is supposed to be given the type Object, but Object does not satisfy the bound of U; one would therefore expect a compiler to reject the code.

            abuckley Alex Buckley
            abuckley Alex Buckley
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: