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

Confusing error and bad co-ordinates while compiling patterns code.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • repo-amber
    • None
    • tools
    • generic
    • generic

      public class X {
          public static void main(String [] args) {
              Object o = args;
              switch (o) {
                 case int x:
                     System.out.println("int x");
                     break;
              }
          }
      }

      while compiling results in:

      /home/srikanth/tmp/X.java:1: error: bad operand types for binary operator '=='
      public class X {
      ^
        first type: int
        second type: Object
      1 error

            gbierman Gavin Bierman
            sadayapalam Srikanth Adayapalam (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: