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

Missing unchecked conversion warning

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: repo-amber
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      This program should elicit an unchecked conversion warning, but does not:

      import java.util.ArrayList;

      public class X {
          public static void main(String [] args) {
              Object o = new ArrayList<X>();
      // if (o instanceof ArrayList<Integer>) { // illegal generic type for instanceof
      // System.out.println("Blah");
      // }
              if (o __matches ArrayList<Integer> ai) {
                  System.out.println("Blah");
              }
              switch (o) {
                  case ArrayList<Integer> ai:
                      System.out.println("ArrayList<Integer>");
                      break;
              }
          }
      }

        Attachments

          Activity

            People

            Assignee:
            sadayapalam Srikanth Adayapalam
            Reporter:
            sadayapalam Srikanth Adayapalam
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: