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

Rule for semantics of ?: in the presence of generics and generic class Class

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 5.0
    • 1.4.2, 5.0
    • tools
    • b28
    • generic, x86
    • solaris_8, windows_xp

      Existing code such as

      Class a = boolean ? A.class : B.class;

      should compile without error, in spite of the fact that (with generics
      enabled) neither A.class nor B.class is a subtype of the other. With
      wildcards, the result type should be

      Class<?>

      Or, if A is a base class of B,

      Class<? extends A>

      This is a backward compatibility issue.

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: