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

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

    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

      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

        Attachments

          Activity

            People

            Assignee:
            gbierman Gavin Bierman
            Reporter:
            sadayapalam Srikanth Adayapalam
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: