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

Missing checkcast when casting to intersection type

XMLWordPrintable

    • b87
    • Verified

      The following program runs w/o exceptions:

      import java.util.*;

      class Test {
          public static void main(String[] args) {
              Runnable r = (List<?> & Runnable)new ArrayList<String>();
          }
      }

      Note that, if the types are swapped in the intersection, the program fails with CCE.

            mcimadamore Maurizio Cimadamore
            mcimadamore Maurizio Cimadamore
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: