compatibility of generic class Class versus ?:

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P3
    • 5.0
    • Affects Version/s: 5.0
    • Component/s: tools
    • b28
    • generic
    • solaris_8

      With generic class Class, there is a compatibility problem
      in code such as

          Class c = b ? A.class : B.class;

      This would be illegal (neither Class<A> nor Class<B>
      is a subtype of the other). We propose to resolve this using the same
      algorithm we use for type inference of a call to a method whose signature is

          <T> T f(boolean b, T t1, T t2);

      Using the wildcard notation, the type of the right-hand-side of the
      assignment above is Class<?>, which is compatible with raw Class, so
      the assignment as a whole succeeds.

            Assignee:
            Neal Gafter (Inactive)
            Reporter:
            Neal Gafter (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: